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?
Related
I am trying to replace the kernel in a boot.img, and then repackage it to a zip that can be flashed. I am trying to follow a guide. Since I am not allowed to post a link, I'll post an excerpt:
E. The Boot.img
We already know that this is the kernel and ramdisk needed to boot up the device. You can pull this apart and swap out the kernel if you would like. For this, you're going to have to run Linux. If you're not able to run Linux natively, download Sun's Virtual Box and an easy to use Linux distro like Ubuntu or Fedora. We will leave custom kernel compilation for another day. To extract and rebuild the Boot.img we need some tools. These are in the attached Boot-tools.zip file found in the first post. Extract the entire zip file into a tools directory in the top level of your working directory. Open your terminal and navigate to your working directory, then enter the following commands:
Code:
/tools/extract-kernel.pl boot.img
/tools/extract-ramdisk.pl boot.img
This will place a copy of the kernel and ramdisk in your working directory. Overwrite the kernel image with the kernel you would like to use. Then re-package everything as so:
Code:
mkbootfs boot.img-ramdisk | gzip > ramdisk-boot
mkbootimg --kernel boot.img-kernel --ramdisk ramdisk-boot --cmdline "no_console_suspend=1 console=null" -o newBoot.img --base 0x19200000
Click to expand...
Click to collapse
I have no problem with the first 3 commands:
extract-kernel.pl boot.img
extract-ramdisk.pl boot.img
mkbootfs boot.img-ramdisk | gzip > ramdisk-boot
But this last command just returns the mkbootimg syntax help blurb:
mkbootimg --kernel boot.img-kernel --ramdisk ramdisk-boot --cmdline "no_console_suspend=1 console=null" -o newBoot.img --base 0x19200000
it returns this:
usage: mkbootimg
--kernel <filename>
--ramdisk <filename>
[ --second <2ndbootloader-filename> ]
[ --cmdline <kernel-commandline> ]
[ --board <boardname> ]
-o|--output <filename>
I noticed that the --base option isn't included in the help, so I left out the "--base 0x19200000". This worked fine and created the newBoot.img file. Will this be safe to use?
Thanks in advance.
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
Well, my problem is when i unpack and repack a funtional recovery.img this dont run.
I use this parameters with cygwin:
./split_bootimg.pl recovery.img
./unpack-bootimg.pl recovery.img
Mkdir ramdisk
Cd ramdisk
gzip -dc ../recovery.img-ramdisk.gz | cpio –i
SOURCE CHANGES
Cd ..
Find ./ramdisk | cpio –o –H newc | gzip > newramdisk.cpio.gz
mkbootimg --cmdline 'no_console_suspend=1 console=null' --kernel recovery.img-kernel --ramdisk newramdisk.cpio.gz -o recoveryNew.img
If i do changes or not, the result after flash the new recoveryNew.img is a frezzee into logo.
What i doing wrong?
HELP!!!
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!
Hello,
I am trying to modify the stock system image by repacking the super.img. I was able to get everything repacked (thanks to this post https://forum.xda-developers.com/t/...r-img-and-flashing-our-modifications.4196625/) and was able to flash it seemingly without issues, but the changes just seemingly are not saved on device. I tried adding a dummy file in the root of the system image, I tried to modify build.props, but they seem to just take no effect. When running as root I can't see the file I made or the build.props changes I made. I even went as far as updating the AP image and reflashing BL,AP,CP, and CSC with Nand Erase and Re-Partition and still it seems like none of the changes are taking effect.
Here is the log from one of my attempts of flashing just the super.img:
<ID:0/020> Added!!
<ID:0/020> Odin engine v(ID:3.1401)..
<ID:0/020> File analysis..
<ID:0/020> Total Binary size: 5080 M
<ID:0/020> SetupConnection..
<ID:0/020> Initialzation..
<ID:0/020> Get PIT for mapping..
<ID:0/020> Firmware update start..
<ID:0/020> NAND Write Start!!
<ID:0/020> SingleDownload.
<ID:0/020> super.img
<ID:0/020> RQT_CLOSE !!
<ID:0/020> RES OK !!
<ID:0/020> Removed!!
<ID:0/020> Remain Port .... 0
<OSM> All threads completed. (succeed 1 / failed 0)
Am I doing something stupid? Am I missing something?
Thanks!
P.S. Here is the script I ended up making to repack the super.img:
#!/bin/bash -x
e2fsck -yf system.img
SYSTEM_SIZE=`stat -c '%s' system.img`
e2fsck -yf odm.img
ODM_SIZE=`stat -c '%s' odm.img`
e2fsck -yf vendor.img
VENDOR_SIZE=`stat -c '%s' vendor.img`
e2fsck -yf product.img
PRODUCT_SIZE=`stat -c '%s' product.img`
lpmake --metadata-size 65536 --super-name super --metadata-slots 1 --device super:6094323712 --group main:$(($SYSTEM_SIZE + $ODM_SIZE + $VENDOR_SIZE + $PRODUCT_SIZE)) \
--partition system:none:$SYSTEM_SIZE --image system=./system.img \
--partition vendor:none:$VENDOR_SIZE --image vendor=./vendor.img \
--partition product:none:$PRODUCT_SIZE --image product=./product.img \
--partition odm:none:$ODM_SIZE --image odm=./odm.img \
--output ./super.new.img
dd if=supermagic.bin bs=1 count=4096 of=super.new.img conv=notrunc
rm -f super.img
img2simg super.new.img super.img
rm -f super.img.lz4
lz4 -B6 --content-size super.img
rm -f super.img.lz4.tar
tar -cf super.img.lz4.tar super.img.lz4
Where `super.img.lz4.tar` is the file I flash using Odin.
Oh, and supermagic.bin is the first 4KB of the stock image. It would not flash without adding that.