reduce bootimage size - Android Q&A, Help & Troubleshooting

I used Cm 13 sources to build a bootimage for my device and everything compiled without any serious error, but i got a very large boot image 8 megabytes. I tried flashing it via TWRP but it constantly gave me error saying bootimage too large for the device.
I also forced flash the bootimage that resulted into a bricked any help would be great
My device is Samsung vibrant
Now im currently compiling the entire rom

try
http://k.japko.eu/boot-img-manipulation.html
or
Okay, first off, let me tell you I'm not at all familiar with your device...so, instead of specifically answering your questions (which would be dangerous/irresponsible of me to have you do something for which I cannot be sure of or vouch since I don't have experience with your device), I'll try to give you some general information (it does seem like you have a good grasp of many of the concepts for getting where you want to go, so maybe I can just fill-in some gaps ).
1. Regarding renaming initlogo.rle to initlogo.rle.old: I'm not sure that doing that will change the splash screen or break something when it goes to look for the initlogo.rle file (a special image file). As you've probably researched, these files are a bit odd and are not just simple image files we're all used to dealing with. I've never successfully been able to create a new initlogo.rle file on my previous attempts a few years back.
2. When you re-pack a bootable image file (boot.img or recovery.img), you need:
- re-pack the updated ramdisk to a new ramdisk.gz file
- rebuild the .img file using mkbootimg utility, specifying the kernel file and the updated ramdisk.gz file
- it's might also be important / necessary to specify the base boot address using the --base <address> parameters when issuing the mkbootimg command where <address> is the base boot address of your device; your bootable image split/unpacking utility should tell you what it sees that the base address is; here is the information I saw when I unpacked the boot.img file that you supplied in your first post:​
[email protected] ~/boot-img-split-tools/ameen
$ ../split_boot.pl boot.img
Page size: 2048 (0x00000800)
Kernel size: 9600396 (0x00927d8c)
Ramdisk size: 1313051 (0x0014091b)
Second size: 0 (0x00000000)
Board name:
Command line: 'console=ttyS0,115200 rw init=/init loglevel=5'
Base address: (0x40000000)
Writing boot/boot.img-kernel ... complete.
Writing boot/boot.img-ramdisk.cpio.gz ... complete.
Unpacking ramdisk... complete.
[email protected] ~/boot-img-split-tools/ameen​
- not having properly set the base boot address might explain why your device didn't boot
- not properly re-packing the ramdisk might explain why your device didn't boot
- not properly rebuilding the bootable image (using the mkbootimg utility)​
3. I kind of understand what you were trying to do by changing the the .md5 file...I'm guessing that you calculated a new MD5 sum of the new boot.img file thinking that would help CWM restore it; that probably doesn't matter unless you've got the MD5/checksum verification enabled; asking/using CWM to restore / install your boot.img is an interesting and non-traditional way of doing that
4. Is the CWM custom recovery specifically built for your device? I did a quick search for it and couldn't find anything. You do indeed need a custom recovery that is built specifically for your device and it's hardware & partition / filesystem layouts and sizes. Just want to make sure that you were aware of that...using the "wrong" custom recovery might be "problematic" (bad).
Edit: I think I might have found which one you used? http://forum.xda-developers.com/showthread.php?t=2189640
5. If you had previously booted into custom recovery on your "broken" device, you still should be able to re-flash or re-launch the custom recovery in the same way that you originally did, yes? The boot and recovery partitions should be separate--so, if you only messed with the boot partition, then you should be okay--unless you've got an incompatible custom recovery that overwrote important things (like your recovery partition...).
I hope that helps...I know I didn't touch on all of your questions...that's probably enough for this post and for what follow-up questions you might have .
Cheers!
source
http://androidforums.com/threads/help-with-boot-img.963358/

I dont have much knowledge about building bootimage but while i was compiling the bootimage i got an error saying no rule to make busybox flash image. So i just copied those file from kernel sources to the out directoru i dont know if that was the problem. Also i had tried using omni 6 sources a few days back i got the right bootimage size but none of my bootimages would bootup my device. Everytime id flash the omni bootimages i got a buggy twrp recovery(faded colors, unreadable text and bootloops. Also regarding the recovery you mentioned there were some dev that built omni lollipop for my device i used TWRP 2.8 to flash all the bootimages

Related

Unpack/repack boot.img-Optimus T

Trying to edit my init.rc to mount /dev/block/mmcblk0p2 on boot, starting to think beating myself to death with the phone would be easier. I have followed the tutorial here:
http://forum.xda-developers.com/showthread.php?t=443994
And tried the alternate method listed here:
http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
But no matter what I do the image never repacks right, I'm only changing 1 line so the file size should stay the same, but when I repack, I get 3.5mb with splitimg, 3.6mb when trying repack-boot.img, 4.4mb when using mkbootimg, and I'm starting off with a 4.2mb boot.img. Even weirder, when I use the splitimg method, the old and new boot.img.ramdisk.gz are the same size, I use the same kernel, and it still repacks a different size than the original. Erasing everything every time to make sure no files are being overwritten. Using ubuntu 9.10. What could cause a different file size and non-booting image each time? Also, when I use the split_bootimg script on the new file, the kernel & ramdisk are the same size. So does that mean it's throwing out data not related to those 2 things, and that's what's killing it? Or is it like the Nexus, where you have to add --base to mkbootimg, and if so, where do I get the number to go with --base?
Watch the video in my signature it'll help you
Thanks, I was already doing it right, but watching your video I decided to redownload the files you had, my mkbootfs was corrupting the ramdisk, it is a good tutorial though, easy to follow even without sound.

[Q] Repacked boot.img gives bootloop, how to do it correctly?

I am building my own ROM now, and I am checking to do my own unsecure stock kernel.
I found the tools that unpack a kernel boot.img file and edit the properties file to make it unsecure, but after repacking the kernel and trying it, device went into a boot loop.
what is needed to repack it?
the tools i found were these here, mainly some perl or shell scripts that does the mkbootimg thing a bit automatically, but I also tried manually.
I did not compile mkbootimg, I used a ready made linux binary, which seem a bit old because it does not contain the --pagesize parameter, and that's the only missing thing from the original, does this cause bootloop?
the ramdisk should be ok, but packing it back with zImage is not....
Fixed
I used Linux tools and they failed, but I found the Android Image Kitchen for windows (cygwin) and strangely they worked, the produced boot.img works as expected !!!

[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

After compilation, what can i do ?

Hy !
i am beginner in rom cooking. I compile with succes Android from Google and ran good in emulator. After that i try to compile Cyanogenmod for my smartphone (jfltexx - Galaxy S4).
Compile with no problems so i try to understand how i can flash my phone and i found Archikitchen.
After somes trys (at the first time i don't understand what is /dev/block/ and where find /boot), finally i have my zip.
Of course, i flash it and it's no working (obviously it would be not funny isn't it ?). My phone start on kernel, display Galaxy S4 logo, after few seconds reboot on recovery mode.
I made a second zip after compile again (make clean, repo sync, source build/envsetup breakfast jfltexx, make -j8) and not working again (compile good but problem with my second zip).
At this point i want to understand how it is works. use Archikitchen is easy but i don't understand process to make a zip. In my folder (~/cyanogen/out/target/product/jfltexx/), i have :
- boot.img
- kernel
- ramdisk.img
-ramdisk-recovery.img
- recovery.img
- system.img
- userdata.img
I don't know exactly how android boots but i know it looks kernel and ramdisk in /boot and after it mounts /system and /data.
I use dd to flash my new recovery from phylz touch to TWRP and i want to do the same thing with my files (system.img to /system, userdata.img /data etc ...) but i think it's not a good idea because i don't know how use boot.img and ramdisk.img to make /boot.
So many questions for a noob, apologize if they are already a thread for all, i didn't found it.
Thx a lot.

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