Question How to extract super.img and how to apply Some modification and then how to repack again to super.img - POCO M3 Pro / Redmi Note 10 5G

How to extract super.img and how to apply Some modification and then how to repack again to super.img on windows?

Related

mkbootimg in cygwin

Is there a way to run mkbootimg in cygwin.. I can extract the ramdisk from boot & recovery images but cannot rebuild.. each time it fails to /usr/bin/mkbootimg: /usr/bin/mkbootimg: cannot execute binary file
Thanks.

[TUTORIAL] Self-assembly of Android Firmwares

I just saw a tutorial in 4PDA by R0iz and wanted to share it here!
The link to the original post translated:
http://tinyurl.com/self-assembly-androidOS
Extract the files *. img
To extract system.img, used unyaffs (http://code.google.com/p/unyaffs/)
I have compiled under Ubuntu 64. With Unyaffs can only be extracted system.img.
To extract boot.img use extract-kernel.pl and extract-ramdisk.pl
# extract-kernel.pl boot.img
# extract-ramdisk.pl boot.img
Click to expand...
Click to collapse
Rebuilding boot.img
After extracting boot.img with the enclosed extract-*. pl
In order to collect boot.img with Custom kernel in the same folder run:
# 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
Rebuilding system.img
At first glance it seems that you can simply mount the image and format it with YAFFS, but it's not because, as SPL Hero does not allow flash system.img directly.
You must use the format update.zip packages for this. (читайте ниже) (See below)
Write update.zip quite simple really. For example, to add the package test.apk in your rum:
- Create an empty folder <workdir>
- Create a folder structure for test.apk (<workdir> / system / app) and copy test.apk
- Create a folder structure for the update-script (<workdir> / META-INF/com/google/android)
- Edit <workdir> / META-INF/com/google/android/update-script
- Insert the following:
show_progress 0.1 0 show_progress 0.1 0
copy_dir PACKAGE:system SYSTEM: copy_dir PACKAGE: system SYSTEM:
set_perm_recursive 0 0 0755 0644 SYSTEM:app set_perm_recursive 0 0 0755 0644 SYSTEM: app
show_progress 0.1 10 show_progress 0.1 10
- Pack the contents <workdir> in zip (not the folder itself <workdir>, only its contents)
Now you have to sign a zip file. Testsign.zip download and copy it to your <SDK> / tools.
Unzip it there, thus creating a sub-folder sign with a file testsign. in it.
Then in the folder <workdir>, run this command:
java-classpath "<SDK> / tools / sign / testsign.jar" testsign file.zip file-signed.zip
Everything is now ready for your update.zip pouring into the apparatus by a modified recovery.
Click to expand...
Click to collapse
Change. Apk package
apk can just unpack an archive, change what you need and pack it back. But in the end you have to sign it as well as update.zip packages.
ODEX files
- What is it? Answer
- How to get rid of them?
For deodex ODEX files, use this howto
Then you can create classes.dex file by running smali from your "out". Then rename it to classes.dex and add it to apk.
- How to create them?
Use dexopt-wrapper on the device.
Click to expand...
Click to collapse
Porting ROM with other devices.
Well, this part is simple smile_good.gif
- Extract system.img
- Extract boot.img
- Replace boot.img-kernel of the original Roma HTC Hero.
- Rebuild boot.img
- Collect update.zip (see how it's done in any Custom rum for Hero)
- Sign and flash.
Device should start, and even be able to call, but probably will not work WiFi, BT, trackball.
Androsign script (Linux)
Androsign allows you to quickly sign the zip and apk. Just put it in <SDK> / tools, then CHMOD + X. If the path to the folder \ tools registered in the PATH, then you can run this script by typing:
androsign /dev/folder1/folder2/update.zip
He will Update-signed.zip (or App-signed.apk, etc.) in the same folder where the original file.
THANKS ARE WELCOMED!
Can we actually use this to port Sense or MIUI ?
this explains part of the process, the steps to do fo that purpose extracting and rebuilding but of course not about the code. i've heard MIUI is complex than sense
Most of us know this allready but nice to see it being said instead of learning the hard way
Sent from my GT540 using XDA Premium App

[Q] Q:How to extract ramdisk in bootimg

Since i got ramdisk from boot.img,i try to extract ramdisk.gz followimg http://forum.xda-developers.com/showthread.php?t=1477845.But icouldn't get any issues.
gzip: ../boot.img-ramdisk.gz::not in gzip format
Any can help?

[HOW TO] Extract kernel image from the Samsung Galaxy S5 VZW firmware

If you interested in extracting the kernel image from the Samsung Galaxy S5 ROM, you should follow the following steps.
This is was tested with the G900VVRU1ANCG_G900VVZW1ANCG_VZW stock ROM firmware.
The first is extracting the files from the ROM firmware file, this is explained in many places and won't be covered here.
Extract the boot.img to some directory, using the Android unpackbootimg utility:
Code:
unpackbootimg -i boot.img -o boot/
After extracting the boot.img file you will usually end up with the following file list:
Code:
boot.img-base
boot.img-cmdline
boot.img-pagesize
boot.img-ramdisk.gz <- this includes the root (/) files, like init*.rc and SELinux policy files
boot.img-zImage <- compressed image of the Android Linux kernel
Next step will be extracting the compressed kernel image from the zImage file. The Android kernel is a self-extracting compressed file, while different devices use different compression methods. While looking at the file contents using hex editor, you can see the decompression code at the beginning, and then at some point the compressed data begins. The compressed image begins where you find the LZO magic header.
Code:
static const unsigned char lzop_magic[9] = {
0x89, 0x4c, 0x5a, 0x4f, 0x00, 0x0d, 0x0a, 0x1a, 0x0a
};
Save the data from the LZO magic header to the end of the file with the zImage.kernel file name.
This firmware and kernel are using LZO compression, and there is an easy to use utility called lzop that is used for the decompression of the file. Just run the following command to decompress the kernel from the zImage.kernel file:
Code:
lzop -d -c zImage.kernel > zImage.kernel.decompressed
And now you have the decompressed kernel for the device ready for exploration, which is also attached to this post.
Note:
I've tried using different scripts that do the job, including galaxys2_kernel_repack and http://forum.xda-developers.com/showthread.php?t=901152 but both failed while extracting the kernel image, although were able to extract the begin position for the LZO compression header.
But it does trip KNOX after flashing, doesn't it?
roman.blachman said:
If you interested in extracting the kernel image from the Samsung Galaxy S5 ROM, you should follow the following steps.
This is was tested with the G900VVRU1ANCG_G900VVZW1ANCG_VZW stock ROM firmware.
The first is extracting the files from the ROM firmware file, this is explained in many places and won't be covered here.
Extract the boot.img to some directory, using the Android unpackbootimg utility:
Code:
unpackbootimg -i boot.img -o boot/
After extracting the boot.img file you will usually end up with the following file list:
Code:
boot.img-base
boot.img-cmdline
boot.img-pagesize
boot.img-ramdisk.gz <- this includes the root (/) files, like init*.rc and SELinux policy files
boot.img-zImage <- compressed image of the Android Linux kernel
Next step will be extracting the compressed kernel image from the zImage file. The Android kernel is a self-extracting compressed file, while different devices use different compression methods. While looking at the file contents using hex editor, you can see the decompression code at the beginning, and then at some point the compressed data begins. The compressed image begins where you find the LZO magic header.
Code:
static const unsigned char lzop_magic[9] = {
0x89, 0x4c, 0x5a, 0x4f, 0x00, 0x0d, 0x0a, 0x1a, 0x0a
};
Save the data from the LZO magic header to the end of the file with the zImage.kernel file name.
This firmware and kernel are using LZO compression, and there is an easy to use utility called lzop that is used for the decompression of the file. Just run the following command to decompress the kernel from the zImage.kernel file:
Code:
lzop -d -c zImage.kernel > zImage.kernel.decompressed
And now you have the decompressed kernel for the device ready for exploration, which is also attached to this post.
Note:
I've tried using different scripts that do the job, including galaxys2_kernel_repack and http://forum.xda-developers.com/showthread.php?t=901152 but both failed while extracting the kernel image, although were able to extract the begin position for the LZO compression header.
Click to expand...
Click to collapse
I tried that and was given a warning of trailing bytes by `lzop`. Later when i do a `file` command on the resulting uncompressed file, it is not a vmlinux ELF image, rather it is a data file. How are we able to repack this image back into zImage? Any advise is appreciated thanks.
What i do if i have boot.img-kernel and boot.img-kernel_offset?
DGKG said:
What i do if i have boot.img-kernel and boot.img-kernel_offset?
Click to expand...
Click to collapse
The boot.img-kernel is your zimage file
What Source you used for Unpack?
Can you share link for you Scripts? or can you provide link to scripts for unpacking and repacking Note 9 Exynos Kernel?
Thanks

repack system.img.ext4 with stock recovery

i want to remove some apk from system. so i plan make odin flashable tarball.
i just test the extract and repack, didn't do any modify, but it was fail.
1.
system.img.ext4.lz4 -> lz4 -> system.img.ext4 -> simg2img -> system.img -> img2simg -> system.img.ext4 -> N960U.tar(only system.img.ext4)
with system.img , i didn't modify anything,
after img2simg :
file system.img.ext4
system.img.ext4: Android sparse image, version: 1.0, Total of 1291776 4096-byte output blocks in 6335 input chunks.
Odin flash fail (auth), mobile show : security check fail system.
2.
system.img.ext4.lz4 -> lz4 -> system.img.ext4 -> N960U.tar(only system.img.ext4)
do not use simg2img or img2simg
after lz4:
file system.img.ext4
system.img.ext4: Android sparse image, version: 1.0, Total of 1291776 4096-byte output blocks in 6277 input chunks.
Odin flash success.
i also try to use mkuserimg.sh to repack android sparse image, but it also make fail.
mkuserimg.sh -s /Volumes/sysmain system.img.ext4 ext4 /system 529114496
The tow system.img.ext4 has some different, i want to compare the tow img file , but it to huge.
Any good idea? how the samsung mobile to check if it own img?
Sorry for my poor english.
[Q] Help on unpack repack ext4 system image
Does any one know how can I unpack and repack ext4 system images using cygwin? can you give me the complete and understandable tutorials on it? I have tried all of the tutorials here in XDA, but it seems that I can't follow the right way. Please...
forum.xda-developers.com
auth fail = OEM lock = BL Lock
must unlock bl or sampwnd
zalmen hatotach said:
[Q] Help on unpack repack ext4 system image
Does any one know how can I unpack and repack ext4 system images using cygwin? can you give me the complete and understandable tutorials on it? I have tried all of the tutorials here in XDA, but it seems that I can't follow the right way. Please...
forum.xda-developers.com
Click to expand...
Click to collapse
What errors do you get?

Categories

Resources