boot.img changes after unpack-repack without edit - Android Q&A, Help & Troubleshooting

I have met some problem with boot.img and need some help if there's somebody know it.
I used unmkbootimg and mkbootimg, I unpacked a boot.img then got zimage and initramfs.cpio.gz, I repacked it without any edit but the new boot.img becames smaller, it changed from 13M to 7.9M, and the phone couldn't boot from new boot.img,
and there is no question if I use a boot.img extracted from an android3.x-version rom, but if the android version changes to 4.x, the unpack-repack process would lose much size...I tested on mi2s' rom......I don't know if there are some files that will be lost in unpack process, or say the process just ignore files other than zimage and initramfs...
does anybody knows why?

binghemoye said:
I have met some problem with boot.img and need some help if there's somebody know it.
I used unmkbootimg and mkbootimg, I unpacked a boot.img then got zimage and initramfs.cpio.gz, I repacked it without any edit but the new boot.img becames smaller, it changed from 13M to 7.9M, and the phone couldn't boot from new boot.img, does anybody knows why?
Click to expand...
Click to collapse
It could be because of incorrect settings for mkbootimg or there more files,than zImage and initramfs, needed for proper work. Hard to say without more information.
Sorry for my bad English.

B.B.N. said:
It could be because of incorrect settings for mkbootimg or there more files,than zImage and initramfs, needed for proper work. Hard to say without more information.
Sorry for my bad English.
Click to expand...
Click to collapse
There is no question if I use a boot.img extracted from an android3.x version rom, but if the android version changes to 4.x, the unpack-repack would lose much size...I tested on mi2s' rom......I don't know if there are some files that will be lost in unpack process, or say the process just ignore files other than zimage and initramfs...

Related

[Q] A few questions related to porting...

ok so im trying to port for the first time to a i5800.
Now i have Ubuntu and the disxda's kitchen in it.
I've got the boot.img , system.img, data.img, zImage and factoryfs.rfs of my phone with me.
Now my questions are:
1. would a Froyo init.rc work for the ICS?
2. When i try to mount the factoryfs.rfs of my phone, the aplications i tried to use always gave an error stating its not a valid CD image or somethingsimimlar(ive used UltraISO and MagicISO)
3. When i try to extract boot.img using disxda's kitchen, it says Android header not found in boot.img or anywhere in the boot.img and the kernel pagesize is 0.
4. i dont want an Update.zip instead i want it like a flashable rom(are they the same?)
Any help would greatly be appreciated.

[Q] [Module] Build and load module on GS3

Hello,
I tried to do a simple task which raise several problem and it start to drive me crazy, so here I am, asking for help. The subject may have been already mentioned, but can't find an issue with the galaxy s3.
I work with ubuntu 12.04 and Odin on win7. My GS3 has XXELL4 baseband, and 3.0.31-742798 kernel version.
I need to load and run a custom module (let's say a "hello world" one for begin) on the galaxy S3.
I compiled it through a Makefile with the toolchain from the ndk package (
Code:
path_to_ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
and the source code from the samsung web site (GT-I9300_JB_Opensource_Update8.zip).
Obviously, when i tried to insmod my module, I've got some compatibility error like
Code:
Exec format error
.
The fact is that the kernel from website is not the same as the phone one.
So I tried to put the kernel from the website on the phone
I compiled it with the same toolchain and I received a zImage file in result. But what to do with this file ? I extracted a boot.img from the phone with Odin and split it (with perl script stuff) to use the extracted files with my compiled zImage for reconstruct a new boot.img. But since fastboot is not available on GS3 (or I miss something) I can't simply
Code:
$ fastboot flash boot boot.img
, and need to use Odin again. So I replace the boot.img from odin's backup folder on my PC with my boot.img. But the nandroid.md5 file raise an error. Am I doing it wrong or too complicated ? If I can correct the md5 error, is that my module will work ?
I also tried to compil my module directly with the kernel from the phone but didn't manage to extract the kernel files to do it. Stuck with a boot.img. Same with the stock kernel from http://forum.xda-developers.com/showthread.php?t=1646610
I made a lot of research but don't find any concrete solutions to my simple task. Maybe I miss something or looking too deep.
Is there a more simple way to run a custom module on the GS3 ?
sorry for my english
Hello and welcome to xda!
You do not have to use odin to flash your kernel, you can do it via custom recovery too.
Just get an simple cwm package of another kernel for s3 and replace the boot.img in the zip.
I attached a simple empty cwm package, just drag your boot.img to the root of the zip with winrar or something.
hsrars-d said:
Hello and welcome to xda!
You do not have to use odin to flash your kernel, you can do it via custom recovery too.
Just get an simple cwm package of another kernel for s3 and replace the boot.img in the zip.
I attached a simple empty cwm package, just drag your boot.img to the root of the zip with winrar or something.
Click to expand...
Click to collapse
Thanks
I've got also a md5 error when i tried to restore with cwm, since I have no md5 file in my folder. Do I need to generate one ? how ?
EDIT: so a generate a md5 file with md5sum, but still have the Exec format error when i try to insmod my module.
ok, im not good with kernel stuff/modules so i cant help you any further...
try to find someone that has experience with kernel modules
edit: found something with google, not exactly for s3 but the error is pretty common:
http://www.linuxquestions.org/questions/linux-kernel-70/insmod-error-version-magic-4175424366/
http://forum.xda-developers.com/showthread.php?t=444338&page=1
http://stackoverflow.com/questions/...for-android-unknown-relocation-27-when-insmod
Why are you posting in this section?
Glebun said:
Why are you posting in this section?
Click to expand...
Click to collapse
well ... I don't yet have access to other section. But If someone could move the thread in a more appropriate one I'll thanks him.
Yes, you do. Questions go in the Q&A section, obviously

[Q] Rockchip kernel image file - how to build?

I have a working Kernel - http://forum.xda-developers.com/attachment.php?attachmentid=1743802&d=1361298599
but I need prepare a new one - compilation it is no problem, but how to prepare img file for taht?.
I heard that this is a Rockchip kernel image file - so I am a looking for information how to build this kind of kernel?
Procesor is RK3066.
mafamafa said:
I have a working Kernel - http://forum.xda-developers.com/attachment.php?attachmentid=1743802&d=1361298599
but I need prepare a new one - compilation it is no problem, but how to prepare img file for taht?.
I heard that this is a Rockchip kernel image file - so I am a looking for information how to build this kind of kernel?
Procesor is RK3066.
Click to expand...
Click to collapse
If that is a zImage, then you need to pack it into boot.img in order to flash.
There are many boot.img tools out there which can help you. But the thing is you will be needing your device's original boot.img (Which can be extracted from your device depending upon the partition) which contains the Ramdisk in order to be successful.
coolsandie said:
If that is a zImage, then you need to pack it into boot.img in order to flash.
There are many boot.img tools out there which can help you. But the thing is you will be needing your device's original boot.img (Which can be extracted from your device depending upon the partition) which contains the Ramdisk in order to be successful.
Click to expand...
Click to collapse
In fact it is a regular (no gziped) image not a zImage. The file after unpacking from RK3066 format starts with bytes d3 f0 21 (to unpack I'm using rkutils ).
But I don't understand why we need to make boot.img with this file and only after that, upload boot.img to the device. Normally it should be possible just to upload kernel.img to the partition where kernel is stored, no?
After kernel from the link above is uploaded to this partition, the device boots up without problem. But when we compile new kernel and upload it (after converting with rk-tools ) it is not even possible to boot the device.
Any idea what's going on? Is compiling a kernel, then converting to rk3066 format is enough ?
flowher said:
In fact it is a regular (no gziped) image not a zImage. The file after unpacking from RK3066 format starts with bytes d3 f0 21 (to unpack I'm using rkutils ).
But I don't understand why we need to make boot.img with this file and only after that, upload boot.img to the device. Normally it should be possible just to upload kernel.img to the partition where kernel is stored, no?
After kernel from the link above is uploaded to this partition, the device boots up without problem. But when we compile new kernel and upload it (after converting with rk-tools ) it is not even possible to boot the device.
Any idea what's going on? Is compiling a kernel, then converting to rk3066 format is enough ?
Click to expand...
Click to collapse
Ok, I just had a look at your link and yes, it contains the kernel.img file. So it should be the kernel image file which needs to be flashed. What you actually needed to do is, unpack that kernel image using the tools of your choice and you'll get the ramdisk, zImage etc when unpacking. If you have compiled kernel from Sources, then you need to replace the zImage with yours (Found in arch/arm/boot) if your compilation was successful without errors and repack it to form the kernel.img.
But that doesn't mean it should boot compulsorily, it may not boot depending upon various weird reasons. You may have to fix it by yourself. Nearest bet is using your device's config file (Found in /proc/config.gz) and use that to compile your kernel. You can find all infos regarding what I've mentioned in this thread:
http://forum.xda-developers.com/showthread.php?t=1748297

[Q]Repack a kernel into a boot.img?

I've been learning some development lately and I have a few questions to ask about the boot.img and kernel and things...
As far to my knowledge, it contains the kernel and the ramdisk, correct?
But what about a .sin file? That is also a kernel, isn't it?
But does it contain the ramdisk? Or is ramdisk included in the kernel itself?
For example, what would happen if I only flashed a .sin file on an empty boot partition?
Would the thing boot?
If yes, does that mean there IS ramdisk in the .sin file?
Furthermore, how would I be able to repack the .sin kernel into a boot.img? Just renaming obviously wouldn't do it... But, would anything?
What I'm trying to do:
From an Xperia FTF FW file, I extracted the kernel in .sin file format.
Now, with ready-to-go META-INF and system folders, I came to a dead end where I can't get the boot.img.
The reason for that is that I'm trying to make a Gingerbread ROM. All other ROMs out there (for this phone) are ICS, therefore the kernel wouldn't be compatible.
I COULD just flash the .sin kernel with a PC, but that isn't practical...
Any ideas what could be done?
Sorry for the tricky and unreadable post, but I've been searching the internet for the past 3 hours. No results found...
Thanks!
--someone755
EDIT: Just thought of this:
Better yet; is there a way to use fastboot or adb to pull the boot.img from the device?

Boot.img or system.img unpack / repack, different size, odin fails, no boot

Well, as the title sugests, I've tried to root my phone (Samsung Galaxy J1 SM-J100MU) and failed. Since no twrp or any other custom recovery is made for my specific model, I tried the method that involves mounting the android systems and modifying the famous build.prop, or putting su binaries inside the /system folder.
I ran an unpack script from ubuntu to decompress the boot file, and simg2img to be able to mount /system following some guides I've found, and made use of mkbootimg to repack it and flash it.
The thing is that the phone won't boot because the modified boot image size differs from the original. The system also differs but Odin won't even flash it and I'll have to reflash the stock rom.
Any ideas about what it can happen? I get no apparently errors during the process of unpacking/repacking the images so I don't know. The only thing I can think of is that the unpack script says something like "There's an extra file in ramdisk; though this file can exist, the script is not made for this type of ramdisk", so I edited the script in order to skip this warning, and everything else went well. The bootimg got unpacked and then the ramdisk and then I modified default.prop.
Well, that's it, I hope you can understand and give me some help in order to proceed.
Thank you in advance.

Categories

Resources