Help with building and flashing a pre-rooted stock rom. - Android Q&A, Help & Troubleshooting

I've tried multiple methods, but I can't seem to get the pre-rooted ROM to flash properly, however, the completely stock ROM flashes just fine, so I'm wondering what in the heck I'm doing wrong.
Here's what I've done after I add the su binaries and deodexed:
-- make_ext4fs WITH -s
-- make_ext4fs WITHOUT -s
-- make_ext4fs WITHOUT -s THEN img2simg
-- This method
After those, I tried these:
-- tar -H ustar -c sboot.bin cm.bin boot.img recovery.img system.img cache.img modem.bin >> Flash.tar
-- tar cfx Flash.tar sboot.bin cm.bin boot.img recovery.img system.img cache.img modem.bin
-- Using 7zip to add the file to a pre-existing tar
-- Renaming system.img to system.img.ext4 (Didn't fail, but it just hanged at recovery at the top and system.img.ext4 as the last log entry)
However, every time it gets to the system.img, it fails, saying "Complete(Write) operation failed."
Is there any fix to this? Or is my phone not accepting a custom system.img?
I've used both Odin3 v3.10.7 and v1.85
Thanks in advance!

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.

[Tutorial][Odin] Extracting Rom and Riding on Parts

Hello, everybody.
In this tutorial we draw our One Package Samsung Rom format. Tar.md5 to get it in parts, the necessary files in Odin so that allows passing the full rom, change, or remove portions of it, before the flash, as CSC and MODEM . In the example, I will work with the Galaxy Ace S5830B.
Required:
1) Cygwim;
2) Rom file in .tar.md5.
Tutorial​
1º) Download and install Cygwin from the link above. See the video tutorial to help you install:
2º) Get rom servers: SamMobile, Samsung Updates ou Information 4 All/
3º) Go to the folder C:\cygwin\home\Assis¹ and create a folder called ROM.
4º) Extract the zip and move the rom tar.md5 to the folder C:\cygwin\home\Assis\ROM:
5º) With everything ready to go work. Open a terminal and type Cygwim:
cd rom
Click to expand...
Click to collapse
5.1) Let us create the first package, APBOOT:
tar -xvf S5830BVJLP4_S5830BVJLP4_S5830BZTOLP4_HOME.tar.md5 arm11boot mibib oemsbl qcsbl
tar -H ustar -c arm11boot mibib oemsbl qcsbl > APBOOT.tar
md5sum -t APBOOT.tar >> APBOOT.tar
mv APBOOT.tar APBOOT.tar.md5
Click to expand...
Click to collapse
6º) Creating CODE:
tar -xvf S5830BVJLP4_S5830BVJLP4_S5830BZTOLP4_HOME.tar.md5 boot.img recovery.img system.rfs
tar -H ustar -c boot.img recovery.img system.rfs > CODE.tar
md5sum -t CODE.tar >> CODE.tar
mv CODE.tar CODE.tar.md5
Click to expand...
Click to collapse
7º) Creating MODEM:
tar -xvf S5830BVJLP4_S5830BVJLP4_S5830BZTOLP4_HOME.tar.md5 amss
tar -H ustar -c amss> MODEM.tar
md5sum -t MODEM.tar >> MODEM.tar
mv MODEM.tar MODEM.tar.md5
Click to expand...
Click to collapse
8º) Creating CSC:
tar -xvf S5830BVJLP4_S5830BVJLP4_S5830BZTOLP4_HOME.tar.md5 csc.rfs
tar -H ustar -c csc.rfs> CSC.tar
md5sum -t CSC.tar >> CSC.tar
mv CSC.tar CSC.tar.md5
Click to expand...
Click to collapse
Okay, now just go on Odin and put each file in its place and flashing.
Let the tests:
Credits:
Adaptation of these posts: [HOW TO] Extracting baseband from .tar.md5 and Custom Odin images
Obs. :
You need to know what files make up each package. You can use any ROM already extracted to base.
¹Folder name must match the Windows user.
Note:
To Moderators
Since I'm not a good English and used Google translator to transcribe the Brazilian forum post where I created, I ask kindly make corrections of spelling and grammatical English to entedimento best of all.
This tutorial is for all Samsung rom in tar.md5 therefore evaluate the best location for posting.
Thank you.
nice tutorial dude:good:
this was very useful ty

Help: Rebuild img for change language

Add language
I test samsung s2 i9100
Extract I9100XXLPQ.tar.md5 --> factoryfs.img (sgs2toext4.jar) --> factoryfs.ext4.img
Ubuntu
...
mkdir /mnt/system
mount factoryfs.ext4.img /mnt/system
cp framework/*.apk /mnt/system/framework/ <---Language change here
cp app/*.apk /mnt/system/app/ <---Language change here
tar cvf factoryfs.img /mnt/system <---suspect here (!)
e2fsck factoryfs.img <--- can abort
umount /mnt/system
step1:
tar cvpf factoryfs.tar factoryfs.img
md5sum -t factoryfs.tar >> factoryfs.tar
mv factoryfs.tar factoryfs.tar.md5
factoryfs.tar.md5 flash with odin failed
step2:
tar -H ustar -c boot.bin cache.img factoryfs.img hidden.img modem.bin param.lfs Sbl.bin zImage > your_odin_package.tar
md5sum -t your_odin_package.tar >> your_odin_package.tar
mv your_odin_package.tar your_odin_package.tar.md5
your_odin_package.tar.md5 flash with odin
boot.bin ok
cache.img ok
factoryfs.img <--- failed here
....stop here.....
please, help me!
Thanks!
thanhlapvn said:
Add language
I test samsung s2 i9100
Extract I9100XXLPQ.tar.md5 --> factoryfs.img (sgs2toext4.jar) --> factoryfs.ext4.img
Ubuntu
...
mkdir /mnt/system
mount factoryfs.ext4.img /mnt/system
cp framework/*.apk /mnt/system/framework/ <---Language change here
cp app/*.apk /mnt/system/app/ <---Language change here
tar cvf factoryfs.img /mnt/system <---suspect here (!)
e2fsck factoryfs.img <--- can abort
umount /mnt/system
step1:
tar cvpf factoryfs.tar factoryfs.img
md5sum -t factoryfs.tar >> factoryfs.tar
mv factoryfs.tar factoryfs.tar.md5
factoryfs.tar.md5 flash with odin failed
step2:
tar -H ustar -c boot.bin cache.img factoryfs.img hidden.img modem.bin param.lfs Sbl.bin zImage > your_odin_package.tar
md5sum -t your_odin_package.tar >> your_odin_package.tar
mv your_odin_package.tar your_odin_package.tar.md5
your_odin_package.tar.md5 flash with odin
boot.bin ok
cache.img ok
factoryfs.img <--- failed here
....stop here.....
please, help me!
Thanks!
Click to expand...
Click to collapse
I think tar cvf factoryfs.image is basically just a tar file not a repacked ext4.image file so i think you should use the command or a tool to repack the image file and that you should continue step 1 or 2 with the repacked file, so what I am suggesting is you dont need these two lines
tar cvf factoryfs.img /mnt/system <---suspect here (!)
e2fsck factoryfs.img <--- can abort
after unmount, repack it in whatever way you like ,then proceed with step 1 or 2 with the repacked file.
Edit:And by repacking I dont mean compressing into a tar again, there maybe tools available for repacking.
Hmm I been meaning to ask you but did you try pushing both apk via a signed zip file through the stock recovery?
Sent from my GT-I9100 using xda app-developers app
king_below_my_lord said:
Hmm I been meaning to ask you but did you try pushing both apk via a signed zip file through the stock recovery?
Sent from my GT-I9100 using xda app-developers app
Click to expand...
Click to collapse
I create update zip (cwm) change language ok but i like build md5 flash via odin (no need recovery, no need root, no need update ver same ver pack update...)
thanhlapvn said:
I create update zip (cwm) change language ok but i like build md5 flash via odin (no need recovery, no need root, no need update ver same ver pack update...)
Click to expand...
Click to collapse
Lol, yeah to each his own preferences. But I always prefer the shortest way, where minimal action is needed, and with root I can make most changes from inside the OS, but I am intrigued which language did you insert?
Edit :Since the matter is over add Solved in title.
Sent from my GT-I9100 using xda app-developers app

How to flash samsung note 3 with zImage

Greetings
I have been trying to modify a stock image, and here is what I have done so far:
I found this link, and followed it in this manner: @ubuntu:~/expermental_stock$ umkbootimg boot.img
unmkbootimg version 1.2 - Mikael Q Kuisma <[email protected]>
Kernel size 8262680
Kernel address 0x8000
Ramdisk size 1064985
Ramdisk address 0x2000000
Secondary size 0
Secondary address 0xf00000
Kernel tags address 0x1e00000
Flash page size 2048
Board name is ""
Command line "console=null androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x37 ehci-hcd.park=3"
*** WARNING ****
This image is built using NON-standard mkbootimg!
OFF_KERNEL_ADDR is 0xFE208100
OFF_RAMDISK_ADDR is 0x00200100
OFF_SECOND_ADDR is 0xFF100100
Please modify mkbootimg.c using the above values to build your image.
****************
Extracting kernel to file zImage ...
Extracting root filesystem to file initramfs.cpio.gz ...
All done.
---------------
To recompile this image, use:
mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x1dfff00 --cmdline 'console=null androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x37 ehci-hcd.park=3' -o new_boot.img
---------------
I copied the original zImage to a backup file:
I copied the original zImage to a backup file: @ubuntu:~/expermental_stock$ cp zImage backup_zImage
I moved my new zImage over: @ubuntu:~/expermental_stock$ cp ~/androidkernel3/arch/arm/boot/zImage .
@ubuntu:~/expermental_stock$ ls
aboot.mbn cache.img.ext4 modem.bin NON-HLOS.bin sbl1.mbn system.img.ext4
backup_zImage info N900PVPUCNC5_N900PSPTCNC5_N900PVPUCNC5_HOME.tar.md5 recovery.img sdi.mbn tz.mbn
boot.img initramfs.cpio.gz N900PVPUCNC5_N900PSPTCNC5_SPR.zip rpm.mbn SS_DL.dll zImage
ran the command again to "recompile" I assume this uses the new zImage @ubuntu:~/expermental_stock$ mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x1dfff00 --cmdline 'console=null androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x37 ehci-hcd.park=3' -o new_boot.img
[email protected]:~/expermental_stock$ ls
aboot.mbn cache.img.ext4 modem.bin new_boot.img rpm.mbn SS_DL.dll zImage
backup_zImage info N900PVPUCNC5_N900PSPTCNC5_N900PVPUCNC5_HOME.tar.md5 NON-HLOS.bin sbl1.mbn system.img.ext4
boot.img initramfs.cpio.gz N900PVPUCNC5_N900PSPTCNC5_SPR.zip recovery.img sdi.mbn tz.mbn @ubuntu:~/expermental_stock$ rm N900PVPUCNC5_N900PSPTCNC5_SPR.zip @ubuntu:~/expermental_stock$ mv backup_zImage /tmp/ @ubuntu:~/expermental_stock$ ls
aboot.mbn info N900PVPUCNC5_N900PSPTCNC5_N900PVPUCNC5_HOME.tar.md5 recovery.img sdi.mbn tz.mbn
boot.img initramfs.cpio.gz new_boot.img rpm.mbn SS_DL.dll zImage
cache.img.ext4 modem.bin NON-HLOS.bin sbl1.mbn system.img.ext4 @ubuntu:~/expermental_stock$ mv boot.img /tmp/
Renamed the new_boot.img to original name @ubuntu:~/expermental_stock$ mv new_boot.img boot.img @ubuntu:~/expermental_stock$
Oh I also moved the original files to /tmp @ubuntu:~/expermental_stock$ mv backup_zImage /tmp/ @ubuntu:~/expermental_stock$ mv boot.img /tmp/
[email protected]:~/expermental_stock$ ls
aboot.mbn info N900PVPUCNC5_N900PSPTCNC5_N900PVPUCNC5_HOME.tar.md5 rpm.mbn SS_DL.dll zImage
boot.img initramfs.cpio.gz NON-HLOS.bin sbl1.mbn system.img.ext4
cache.img.ext4 modem.bin recovery.img sdi.mbn tz.mbn
moved the original tar file to another directory
[email protected]:~/expermental_stock$ mv N900PVPUCNC5_N900PSPTCNC5_N900PVPUCNC5_HOME.tar.md5 /tmp/ @ubuntu:~/expermental_stock$
Then I used this link to create a tar.md5 file, and I ziped the whole thing again : @ubuntu:~/expermental_stock$ tar -H ustar -c * > N900PVPUCNC5_N900PSPTCNC5_N900PVPUCNC5_HOME.tar @ubuntu:~/expermental_stock$ md5sum -t N900PVPUCNC5_N900PSPTCNC5_N900PVPUCNC5_HOME.tar >> N900PVPUCNC5_N900PSPTCNC5_N900PVPUCNC5_HOME.tar @ubuntu:~/expermental_stock$ mv N900PVPUCNC5_N900PSPTCNC5_N900PVPUCNC5_HOME.tar N900PVPUCNC5_N900PSPTCNC5_N900PVPUCNC5_HOME.tar.md5 @ubuntu:~/expermental_stock$zip -r N900PVPUCNC5_N900PSPTCNC5_SPR *
I moved the zip file to a location I have used to to flash other images before. I get the unable to mount error, which I got before and was able to flash before. I have twrp on my phone. I also get the error "unable to open zip file".
Do you see anything wrong with what I have done?

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?

Categories

Resources