Unpack and repack boot.img (Help needed, stuck at booting) - General Questions and Answers

I've been trying for like hours to unpack and repack a boot.img.
I never made this before, I was reading much (actually too much) on the internet on how getting this done.
So... I downloaded some tools for unpacking and repacking the boot.img and followed this tutorial:
http://whiteboard.ping.se/Android/Unmkbootimg
and I suceeded. But when I repack it (WITHOUT modifying ANYTHING), and try to flash the "new" boot.img to the phone, the phone turns on and then shows up on the upper left corner of the screen "KERNEL IS NOT SEANDROID ENFORCING" and stays there. It goes no further. I simply unpacked it and then repacked it (to see if I made the whole process right, before screwing anything up).
I saw something curious: The original boot.img is 14.3MB and the new boot.img only 14.0MB. Is there anything that got lost in the process? Remember that I set all the "adresses" to the files right.
Unpacking command:
Code:
[email protected]:~/Área de Trabalho/UNPACKTOOLS$ ./umkbootimg boot.img
unmkbootimg version 1.2 - Mikael Q Kuisma <[email protected]>
Kernel size 11073112
Kernel address 0x8000
Ramdisk size 2525114
Ramdisk address 0x1000000
Secondary size 0
Secondary address 0xf00000
Kernel tags address 0x100
Flash page size 2048
Board name is ""
Command line "console=ttyS1,115200n8"
This image is built using standard mkbootimg
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 0x0 --cmdline 'console=ttyS1,115200n8' -o new_boot.img
---------------
[email protected]:~/Área de Trabalho/UNPACKTOOLS$
And repacking:
Code:
[email protected]:~/Área de Trabalho/UNPACKTOOLS$ ./mkbootimg --kernel zImage --ramdisk initramfs.cpio --base 0x0 --cmdline 'console=ttyS1,115200n8' -o new_boot.img --pagesize 2048 --ramdiskaddr 0x1000000
[email protected]:~/Área de Trabalho/UNPACKTOOLS$
I also tried without those adresses. Without luck.
The phone is a (Samsung J1) "J120H" with Android 5.1.1.
And the boot image I obtained by downloading the stock rom and unpacking ONLY the "boot.img". Remember: When I flash this file alone, IT WORKS. When I unpack and repack it, it stops working.
Here are the tools which came and my boot.img (unmodified from stock rom): https://volafile.io/get/overPkOTw66W/ToolsWithBootImg.zip
If anyone can direct me in the right way, I would be very happy.
Or maybe even modify the boot.img for me, set "secure=0" and repack it. Because my main goal is to root the device.
Thanks.

Anyone?
Sent from my SM-G925F using XDA-Developers mobile app

Nobody knows how to unpack a boot.img?
Sent from my SM-G925F using XDA-Developers mobile app

Not exactly answer to your problem. I tried same thing - just unpacking and repacking It stuck at boot saying 'fastboot reason fall through normal boot mode'
This SO: has similar post : http://stackoverflow.com/questions/27889621/error-with-repacking-boot-img-android
I suspect the base address is wrong in all three cases.
May be if you are searching for solution we can search together
[[email protected] kitkat]$ ./unmkbootimg boot.img
Kernel size 6022016
Kernel address 0x8000
Ramdisk size 716888
Ramdisk address 0x1000000
Secondary size 0
Secondary address 0xf00000
Kernel tags address 0x100
Flash page size 2048
Board name is ""
Command line "console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x37 utags.blkdev=/dev/block/platform/msm_sdcc.1/by-name/utags vmalloc=400M"
Extracting kernel.gz ...
Extracting initramfs.cpio.gz ...
All done.
---------------
To recompile this image, use:
mkbooting --kernel kernel.gz --ramdisk initramfs.cpio.gz --base 0x0 --cmdline 'console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x37 utags.blkdev=/dev/block/platform/msm_sdcc.1/by-name/utags vmalloc=400M' -o new_boot.img
---------------
Click to expand...
Click to collapse

glaks said:
Not exactly answer to your problem. I tried same thing - just unpacking and repacking It stuck at boot saying 'fastboot reason fall through normal boot mode'
This SO: has similar post : http://stackoverflow.com/questions/27889621/error-with-repacking-boot-img-android
I suspect the base address is wrong in all three cases.
May be if you are searching for solution we can search together
Click to expand...
Click to collapse
If you discover why, please let me know
Sent from my SM-G925F using XDA-Developers mobile app

Fusseldieb said:
If you discover why, please let me know
Sent from my SM-G925F using XDA-Developers mobile app
Click to expand...
Click to collapse
Changing --base 0x0 to --base 0x10008000 does the trick. You may need to play around with your device PHYS_OFFSET. For more read this https://lyncd.com/2011/03/android-kernel-mkbootimg-base/
http://k.japko.eu/boot-img-manipulation.html

Fusseldieb said:
I've been trying for like hours to unpack and repack a boot.img.
I never made this before, I was reading much (actually too much) on the internet on how getting this done.
So... I downloaded some tools for unpacking and repacking the boot.img and followed this tutorial:
http://whiteboard.ping.se/Android/Unmkbootimg
and I suceeded. But when I repack it (WITHOUT modifying ANYTHING), and try to flash the "new" boot.img to the phone, the phone turns on and then shows up on the upper left corner of the screen "KERNEL IS NOT SEANDROID ENFORCING" and stays there. It goes no further. I simply unpacked it and then repacked it (to see if I made the whole process right, before screwing anything up).
I saw something curious: The original boot.img is 14.3MB and the new boot.img only 14.0MB. Is there anything that got lost in the process? Remember that I set all the "adresses" to the files right.
Unpacking command:
Code:
[email protected]:~/Área de Trabalho/UNPACKTOOLS$ ./umkbootimg boot.img
unmkbootimg version 1.2 - Mikael Q Kuisma <[email protected]>
Kernel size 11073112
Kernel address 0x8000
Ramdisk size 2525114
Ramdisk address 0x1000000
Secondary size 0
Secondary address 0xf00000
Kernel tags address 0x100
Flash page size 2048
Board name is ""
Command line "console=ttyS1,115200n8"
This image is built using standard mkbootimg
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 0x0 --cmdline 'console=ttyS1,115200n8' -o new_boot.img
---------------
[email protected]:~/Área de Trabalho/UNPACKTOOLS$
And repacking:
Code:
[email protected]:~/Área de Trabalho/UNPACKTOOLS$ ./mkbootimg --kernel zImage --ramdisk initramfs.cpio --base 0x0 --cmdline 'console=ttyS1,115200n8' -o new_boot.img --pagesize 2048 --ramdiskaddr 0x1000000
[email protected]:~/Área de Trabalho/UNPACKTOOLS$
I also tried without those adresses. Without luck.
The phone is a (Samsung J1) "J120H" with Android 5.1.1.
And the boot image I obtained by downloading the stock rom and unpacking ONLY the "boot.img". Remember: When I flash this file alone, IT WORKS. When I unpack and repack it, it stops working.
Here are the tools which came and my boot.img (unmodified from stock rom): https://volafile.io/get/overPkOTw66W/ToolsWithBootImg.zip
If anyone can direct me in the right way, I would be very happy.
Or maybe even modify the boot.img for me, set "secure=0" and repack it. Because my main goal is to root the device.
Thanks.
Click to expand...
Click to collapse
Try using Carliv Kitchen Image

Related

unpacking and repacking boot.img from stock rom

Hi all,
Since it took me some time to figure out the correct values I guess this info can be useful to someone out there
1) the boot partition is mmcblk0p20 but it is signed. To get something meaningful out of it you need to drop the head of it
Code:
dd if=/dev/block/mmcblk0p20 of=boot.img bs=256 skip=1
2) to repack you need to pass the options
Code:
--pagesize 2048 --base 40400000
to mkbootimg

[DEV] Kernel board

Hi,
Does someone knows which codename for the board the SGS+ use?
I know its for SGS2 in the kernel source: arch/arm/s5pv310.
What is it for SGS+?
It is for OC´ing
Netchip
stock kernel
Hi Netchip,
I don't know the codename.
Can somebody confirm following about the stock kernel:
-kernel base address 0x00400000
-pagesize 4096
As soon as I unpack and repack the boot.img (without modifications), the device doesn't boot anymore. Binary comparison between the repacked and original boot.img shows, that the last 30% of the file has changed.
I use the command
> mkbootimg --kernel zImage --ramdisk ramdisk --base 0x00400000 --pagesize 4096 -o repackedBoot.img
The same way workes on HTC and SE devices. Could it be somehow different for S+?
Any idea?
Thanks,
Adrian

[guide] How to unpack/repack kernel

U all must be thinking that there are a hell lot of guides for this than what this guide is here for?
And the answer is that i have used almost all guides to extract our kernel for latest builds like cm7,cm9 etc but after using the guides present here on xda , after the last step i didn't get any directories instead got two files name ramdisk.gz and recovery.cpio now this guide will tell what to do next!!!
First of all download the perl scripts from
HERE
Now after download do this:
1. Create two directories and sub directories:
$ mkdir -p old-boot/ramdisk
$ mkdir new-boot
2. Copy the zImage file which ye have made to the "new-boot"
3. Put your old directory boot.img to the "old-boot"
4. Extract the directory bootimgutils.zip to "old-boot"
5. Split boot.img with the command:
$ cd old-boot
$ ./boot.img split_bootimg.pl
or
$ perl split_bootimg.pl boot.img
there will be an appearance of more or less like this (depending on the type of your device):
Page size: 2048 (0x00000800)
Kernel size: 1388548 (0x00153004)
Ramdisk size: 141 518 (0x000228ce)
Second size: 0 (0x00000000)
Board name:
Command line: no_console_suspend = 1
Writing boot.img-kernel ... complete.
Writing boot.img-ramdisk.gz ... complete.
of the split will produce two files, namely boot.img-kernel and boot.img-ramdisk.gz
boot.img-kernel = kernel/zImage
boot.img-ramdisk = ramdisk
6. Now to edit the ramdisk then unpack the boot-img-ramdisk.gz with the following command :
$ cd ramdisk
$ gzip -dc ../boot.img-ramdisk.gz | cpio -i
after that u will have two files "ramdisk.gz" and "recovery.cpio"
7. Now go to ubuntu software center n download a application know as Ark
8. now right click on ramdisk.gz choose open with ark after that extract all the files
9.Now u will have all those directories n files u want!!!!
10. After editing repacking them by drag n drop method i.e. open ramdisk.gz file again using ark than select all those files u just extracted drag them and drop them on ramdisk.gz (opend in ark)
11.Now do the same with recovery.cpio if u want to edit something from it else skip
12 Now u have to repack all that stuff for that do
first repack ramdisk for that use
"find . | cpio -o -H newc | gzip > ../newramdisk.cpio.gz"
After that u have to repack boot.img for that use this
(if u have editing ramdisk)
$ ./mkbootimg --kernel /home/your user_id/new-boot/zImage --ramdisk /home/your user-id/old-boot/newramdisk.cpio.gz --base 0x80000000 --pagesize 2048 -o /home/user-id/new-boot/boot.img
(if u have not edited ramdisk that use)
$ ./mkbootimg --kernel /home/your user_id/new-boot/zImage --ramdisk /home/your user-id/old-boot/boot.img-ramdisk --base 0x80000000 --pagesize 2048 -o /home/user-id/new-boot/boot.img
Note: if u have made ur own zimage than place it in the "New-boot" folder n delete all other files
if u want repack the old zimage than rename the ur extracted "boot.img-kernel" to "zimage" n place in "New-boot" folder
Remeber u will have ur new boot.img in "New boot folder"
========================================================
Now for those who can't Download ark using Software center
1. download ark from this site
2. upack the ramdisk.gz/recovery.cpio using this command
ark --extract /home/your user-id/old-boot/ramdisk/ramdisk.gz
3. repack using
ark --add /home/your user-id/old-boot/ramdisk
it will promp the name of archive to add files to
choose the ramdisk.gz file!!!
The End
"HAVE A HAPPY KERNELING"
sachin sharma said:
U all must be thinking that there are a hell lot of guides for this than what this guide is here for?
And the answer is that i have used almost all guides to extract our kernel for latest builds like cm7,cm9 etc but after using the guides present here on xda , after the last step i didn't get any directories instead got two files name ramdisk.gz and recovery.cpio now this guide will tell what to do next!!!
First of all download the perl scripts from
HERE
Now after download do this:
1. Create two directories and sub directories:
$ mkdir -p old-boot/ramdisk
$ mkdir new-boot
2. Copy the zImage file which ye have made to the "new-boot"
3. Put your old directory boot.img to the "old-boot"
4. Extract the directory bootimgutils.zip to "old-boot"
5. Split boot.img with the command:
$ cd old-boot
$ ./boot.img split_bootimg.pl
or
$ perl split_bootimg.pl boot.img
there will be an appearance of more or less like this (depending on the type of your device):
Page size: 2048 (0x00000800)
Kernel size: 1388548 (0x00153004)
Ramdisk size: 141 518 (0x000228ce)
Second size: 0 (0x00000000)
Board name:
Command line: no_console_suspend = 1
Writing boot.img-kernel ... complete.
Writing boot.img-ramdisk.gz ... complete.
of the split will produce two files, namely boot.img-kernel and boot.img-ramdisk.gz
boot.img-kernel = kernel/zImage
boot.img-ramdisk = ramdisk
6. Now to edit the ramdisk then unpack the boot-img-ramdisk.gz with the following command :
$ cd ramdisk
$ gzip -dc ../boot.img-ramdisk.gz | cpio -i
after that u will have two files "ramdisk.gz" and "recovery.cpio"
7. Now go to ubuntu software center n download a application know as Ark
8. now right click on ramdisk.gz choose open with ark after that extract all the files
9.Now u will have all those directories n files u want!!!!
10. After editing repacking them by drag n drop method i.e. open ramdisk.gz file again using ark than select all those files u just extracted drag them and drop them on ramdisk.gz (opend in ark)
11.Now do the same with recovery.cpio if u want to edit something from it else skip
12 Now u have to repack all that stuff for that do
first repack ramdisk for that use
"find . | cpio -o -H newc | gzip > ../newramdisk.cpio.gz"
After that u have to repack boot.img for that use this
(if u have editing ramdisk)
$ ./mkbootimg --kernel /home/your user_id/new-boot/zImage --ramdisk /home/your user-id/old-boot/newramdisk.cpio.gz --base 0x80000000 --pagesize 2048 -o /home/user-id/new-boot/boot.img
(if u have not edited ramdisk that use)
$ ./mkbootimg --kernel /home/your user_id/new-boot/zImage --ramdisk /home/your user-id/old-boot/boot.img-ramdisk --base 0x80000000 --pagesize 2048 -o /home/user-id/new-boot/boot.img
Note: if u have made ur own zimage than place it in the "New-boot" folder n delete all other files
if u want repack the old zimage than rename the ur extracted "boot.img-kernel" to "zimage" n place in "New-boot" folder
Remeber u will have ur new boot.img in "New boot folder"
========================================================
Now for those who can't Download ark using Software center
1. download ark from this site
2. upack the ramdisk.gz/recovery.cpio using this command
ark --extract /home/your user-id/old-boot/ramdisk/ramdisk.gz
3. repack using
ark --add /home/your user-id/old-boot/ramdisk
it will promp the name of archive to add files to
choose the ramdisk.gz file!!!
The End
"HAVE A HAPPY KERNELING"
Click to expand...
Click to collapse
It is use with Linux
Sent from my Droid X using XDA Premium HD app
I wish to quote all post too
Sent from my GT-I9003 using XDA
yes it is to be done in linux
loukalok said:
It is use with Linux
Sent from my Droid X using XDA Premium HD app
Click to expand...
Click to collapse
if possible plz remove quoted post
sachin sharma said:
U all must be thinking that there are a hell lot of guides for this than what this guide is here for?
And the answer is that i have used almost all guides to extract our kernel for latest builds like cm7,cm9 etc but after using the guides present here on xda , after the last step i didn't get any directories instead got two files name ramdisk.gz and recovery.cpio now this guide will tell what to do next!!!
First of all download the perl scripts from
HERE
Now after download do this:
1. Create two directories and sub directories:
$ mkdir -p old-boot/ramdisk
$ mkdir new-boot
2. Copy the zImage file which ye have made to the "new-boot"
3. Put your old directory boot.img to the "old-boot"
4. Extract the directory bootimgutils.zip to "old-boot"
5. Split boot.img with the command:
$ cd old-boot
$ ./boot.img split_bootimg.pl
or
$ perl split_bootimg.pl boot.img
there will be an appearance of more or less like this (depending on the type of your device):
Page size: 2048 (0x00000800)
Kernel size: 1388548 (0x00153004)
Ramdisk size: 141 518 (0x000228ce)
Second size: 0 (0x00000000)
Board name:
Command line: no_console_suspend = 1
Writing boot.img-kernel ... complete.
Writing boot.img-ramdisk.gz ... complete.
of the split will produce two files, namely boot.img-kernel and boot.img-ramdisk.gz
boot.img-kernel = kernel/zImage
boot.img-ramdisk = ramdisk
6. Now to edit the ramdisk then unpack the boot-img-ramdisk.gz with the following command :
$ cd ramdisk
$ gzip -dc ../boot.img-ramdisk.gz | cpio -i
after that u will have two files "ramdisk.gz" and "recovery.cpio"
7. Now go to ubuntu software center n download a application know as Ark
8. now right click on ramdisk.gz choose open with ark after that extract all the files
9.Now u will have all those directories n files u want!!!!
10. After editing repacking them by drag n drop method i.e. open ramdisk.gz file again using ark than select all those files u just extracted drag them and drop them on ramdisk.gz (opend in ark)
11.Now do the same with recovery.cpio if u want to edit something from it else skip
12 Now u have to repack all that stuff for that do
first repack ramdisk for that use
"find . | cpio -o -H newc | gzip > ../newramdisk.cpio.gz"
After that u have to repack boot.img for that use this
(if u have editing ramdisk)
$ ./mkbootimg --kernel /home/your user_id/new-boot/zImage --ramdisk /home/your user-id/old-boot/newramdisk.cpio.gz --base 0x80000000 --pagesize 2048 -o /home/user-id/new-boot/boot.img
(if u have not edited ramdisk that use)
$ ./mkbootimg --kernel /home/your user_id/new-boot/zImage --ramdisk /home/your user-id/old-boot/boot.img-ramdisk --base 0x80000000 --pagesize 2048 -o /home/user-id/new-boot/boot.img
Note: if u have made ur own zimage than place it in the "New-boot" folder n delete all other files
if u want repack the old zimage than rename the ur extracted "boot.img-kernel" to "zimage" n place in "New-boot" folder
Remeber u will have ur new boot.img in "New boot folder"
========================================================
Now for those who can't Download ark using Software center
1. download ark from this site
2. upack the ramdisk.gz/recovery.cpio using this command
ark --extract /home/your user-id/old-boot/ramdisk/ramdisk.gz
3. repack using
ark --add /home/your user-id/old-boot/ramdisk
it will promp the name of archive to add files to
choose the ramdisk.gz file!!!
The End
"HAVE A HAPPY KERNELING"
Click to expand...
Click to collapse
Can I build a custom kernel for Android using any distros that is based on Ubuntu?
Silentkiller101197 said:
Can I build a custom kernel for Android using any distros that is based on Ubuntu?
Click to expand...
Click to collapse
Just above ur post plz read my post. Plz remove quoted post.
Silentkiller101197 said:
Can I build a custom kernel for Android using any distros that is based on Ubuntu?
Click to expand...
Click to collapse
Yes, you can use any *nix system
Few observations:
To make boot.img use:
Code:
mkbootimg --kernel zImage --ramdisk bootimg-ramdisk.cpio.gz --cmdline [URL="https://github.com/teamhacksung/android_device_samsung_galaxysl/blob/ics/BoardConfig.mk#L20"]"console=ttySAC2,115200 consoleblank=0"[/URL] --base [URL="https://github.com/teamhacksung/android_device_samsung_galaxysl/blob/ics/BoardConfig.mk#L21"]0x10000000[/URL] --pagesize [URL="https://github.com/teamhacksung/android_device_samsung_galaxysl/blob/ics/BoardConfig.mk#L19"]4096[/URL] --output boot.img
Use BBCODE to make the guide easier to read.
You don't necessarily need Ark, nearly every file archiver in linux can do that and there are also command line tools that are surely included in your linux distro (see the content of the script attached).
You need to sign up to download the scripts.
Are you sure about this?
Code:
./boot.img split_bootimg.pl
I think you swapped the names (I can't verify it, the reason is right above )
___
Here attached there's a script I made to easly unpack and repack CM kernels. It's based on this: http://forum.xda-developers.com/showthread.php?t=1242675
How to use it:
Place your boot.img in the same directory of the scripts and then run:
Code:
./unpack
It will extract the kernel and the compressed ramdisk.
Code:
./unpack -a
Same as above, but it will completely extract the ramdisk.
Code:
./repack
To make the new boot.img. It will also create kernel-updater.zip to flash the kernel from recovery.
If you put a directory named modules inside ./outfiles/ (it's created after you run ./unpack) with your self built modules (those that will go in /system/lib/modules/), they will be included in the updater zip.
Thanks to alfrix for the updated mkbootimg and the "teamhacksung styled" updater-script .
loSconosciuto said:
Few observations:
To make boot.img use:
Code:
mkbootimg --kernel zImage --ramdisk bootimg-ramdisk.cpio.gz --cmdline [URL="https://github.com/teamhacksung/android_device_samsung_galaxysl/blob/ics/BoardConfig.mk#L20"]"console=ttySAC2,115200 consoleblank=0"[/URL] --base [URL="https://github.com/teamhacksung/android_device_samsung_galaxysl/blob/ics/BoardConfig.mk#L21"]0x10000000[/URL] --pagesize [URL="https://github.com/teamhacksung/android_device_samsung_galaxysl/blob/ics/BoardConfig.mk#L19"]4096[/URL] --output boot.img
Use BBCODE to make the guide easier to read.
You don't necessarily need Ark, nearly every file archiver in linux can do that and there are also command line tools that are surely included in your linux distro (see the content of the script attached).
You need to sign up to download the scripts.
Are you sure about this?
Code:
./boot.img split_bootimg.pl
I think you swapped the names (I can't verify it, the reason is right above )
___
Here attached there's a script I made to easly unpack and repack CM kernels. It's based on this: http://forum.xda-developers.com/showthread.php?t=1242675
How to use it:
Place your boot.img in the same directory of the scripts and then run:
Code:
./unpack
It will extract the kernel and the compressed ramdisk.
Code:
./unpack -a
Same as above, but it will completely extract the ramdisk.
Code:
./repack
To make the new boot.img. It will also create kernel-updater.zip to flash the kernel from recovery.
If you put a directory named modules inside ./outfiles/ (it's created after you run ./unpack) with your self built modules (those that will go in /system/lib/modules/), they will be included in the updater zip.
Thanks to alfrix for the updated mkbootimg and the "teamhacksung styled" updater-script .
Click to expand...
Click to collapse
NO i tried most archives but they dont work they again give the same file i.e. ramdisk.gz
try it than say anything!!!
n there are many ways to unpack / repack anything so don't say that this is not neccessary or that is not neccessary
this thread is just about my preferred way!!!
if have ur own way than we will be happy to see ur guide thread!!
waiting for ur thread!!!
unpacking repacking can b easily done with Skin's unpack repack tools i use those best way to split kernels and ramdisk works like a charm
sachin sharma said:
NO i tried most archives but they dont work they again give the same file i.e. ramdisk.gz
try it than say anything!!!
n there are many ways to unpack / repack anything so don't say that this is not neccessary or that is not neccessary
this thread is just about my preferred way!!!
if have ur own way than we will be happy to see ur guide thread!!
waiting for ur thread!!!
Click to expand...
Click to collapse
I'm sorry, I didn't want to bother with my post.
I won't open a new thread, I was almost adding my scripts to skin's thread, but then I saw this one and it was about unpacking a CyanogenMod boot.img, so I added it here. There's no need to open a new thread in my opinion, because I don't have nothing more to say.
For the file archiver thing, I'm pretty sure of what I'm saying. Maybe you couldn't open it with other programs because you need to do it twice. The ramdisk is first gzip compressed and then cpio compressed. Maybe Ark does it twice automatically, but in linux there's not so much difference between a file archiver and another, they are all frontend and use the same tools almost always or maybe when you installed Ark other needed programs where automatically installed.
Regarding the mkbootimg arguments. I downloaded your tools and they confirmed what I wrote and I'm not surprised of this, because I'm using the same arguments amit/codeworkx/waleedq/dhiru used/are using in their kernels (as I linked you in my previous post).
Code:
Page size: 4096 (0x00001000)
Kernel size: 3429280 (0x003453a0)
Ramdisk size: 2957744 (0x002d21b0)
Second size: 0 (0x00000000)
Board name:
Command line: console=ttySAC2,115200 consoleblank=0
Writing boot.img-kernel ... complete.
Writing boot.img-ramdisk.gz ... complete.
It doesn't mean that you must use them, I've never said anything like this, but I'm pretty sure they all know better than me what they are doing, so I prefer to stick with those values and that's what I wanted to say in my previous post, but I admit that it sounded like "you are wrong, you must do this like this".
I really appreciate your effort, it was not easy for me at first to understand the differences between a stock boot.img and a CM one, so a guide like this would have been really helpful.
shriomman said:
unpacking repacking can b easily done with Skin's unpack repack tools i use those best way to split kernels and ramdisk works like a charm
Click to expand...
Click to collapse
So you are saying that with those tools you were able to unpack and repack the ramdisk changing things in it? Because I can't see this in his tools, so if they are working it simply means that you are not completely unpacking your boot.img, but simply splitting the kernel and the ramdisk.
loSconosciuto said:
I'm sorry, I didn't want to bother with my post.
I won't open a new thread, I was almost adding my scripts to skin's thread, but then I saw this one and it was about unpacking a CyanogenMod boot.img, so I added it here. There's no need to open a new thread in my opinion, because I don't have nothing more to say.
For the file archiver thing, I'm pretty sure of what I'm saying. Maybe you couldn't open it with other programs because you need to do it twice. The ramdisk is first gzip compressed and then cpio compressed. Maybe Ark does it twice automatically, but in linux there's not so much difference between a file archiver and another, they are all frontend and use the same tools almost always or maybe when you installed Ark other needed programs where automatically installed.
Regarding the mkbootimg arguments. I downloaded your tools and they confirmed what I wrote and I'm not surprised of this, because I'm using the same arguments amit/codeworkx/waleedq/dhiru used/are using in their kernels (as I linked you in my previous post).
Code:
Page size: 4096 (0x00001000)
Kernel size: 3429280 (0x003453a0)
Ramdisk size: 2957744 (0x002d21b0)
Second size: 0 (0x00000000)
Board name:
Command line: console=ttySAC2,115200 consoleblank=0
Writing boot.img-kernel ... complete.
Writing boot.img-ramdisk.gz ... complete.
It doesn't mean that you must use them, I've never said anything like this, but I'm pretty sure they all know better than me what they are doing, so I prefer to stick with those values and that's what I wanted to say in my previous post, but I admit that it sounded like "you are wrong, you must do this like this".
I really appreciate your effort, it was not easy for me at first to understand the differences between a stock boot.img and a CM one, so a guide like this would have been really helpful.
So you are saying that with those tools you were able to unpack and repack the ramdisk changing things in it? Because I can't see this in his tools, so if they are working it simply means that you are not completely unpacking your boot.img, but simply splitting the kernel and the ramdisk.
Click to expand...
Click to collapse
ok thnx for ur suggestions
but i have tried all the steps i have written
i successfully complete compiling kernel using this guide n will sill use it
if u dont want to use this guide or like another guide that its ur choice
have a good day!!!
So you are saying that with those tools you were able to unpack and repack the ramdisk changing things in it? Because I can't see this in his tools, so if they are working it simply means that you are not completely unpacking your boot.img, but simply splitting the kernel and the ramdisk.
Click to expand...
Click to collapse
Skin's tool splits kernel and ramdisk.... after that you can use gunzip from the command line to extract, modify and repack the cpio archive into the gz archive. Then again use skin's tool to repack the boot.img
Sent from my GT-I9003 using XDA
Do u guyz think that i shud delete this thread?
if so plz do tell me i will request mods to delete it!!!!!
Why?
Sent from my Droid X using XDA Premium HD app
loukalok said:
Why?
Sent from my Droid X using XDA Premium HD app
Click to expand...
Click to collapse
see all post above!!!!
all stating other ways to do the same!!!
sachin sharma said:
see all post above!!!!
all stating other ways to do the same!!!
Click to expand...
Click to collapse
Buddy u are taking this in wrong way. Nobody is saying that your guide is wrong or not useful. People are just sharing different way of unpacking & repacking kernel. If in future if any new member visit this thread then he can find different ways of kernel unpacking & repacking. Take people suggestion in positive way buddy We all really appreciate ur work buddy.
Guys can also refer to my thread which i created a long time back.
http://forum.xda-developers.com/showthread.php?t=1500889
sachin sharma said:
Do u guyz think that i shud delete this thread?
if so plz do tell me i will request mods to delete it!!!!!
Click to expand...
Click to collapse
We're just sharing buddy... chill...
Sent from my GT-I9003 using XDA

What base/pagesize parameters to use for mkbootimg?

I want to mod my stock boot.img for init.d support, but I'm not sure what "base" and "pagesize" parameters to use with mkbootimg. Can anyone help me out?
See here lines 37 and 38
imnuts said:
See here lines 37 and 38
Click to expand...
Click to collapse
Thanks! So, these settings are specific to the kernel. I see that for CM kernel, I would use:
BOARD_KERNEL_PAGESIZE := 4096
BOARD_KERNEL_BASE := 0x40000000
I was also trying to modify the stock boot.img for my device (p3110) and I came across a tool called "unmkbootimg" found here:
http://forum.xda-developers.com/showthread.php?t=1877807
When I use this new tool to extract the stock boot.img, I get this:
mkbootimg --kernel kernel.gz --ramdisk initramfs.cpio.gz --base 0x80000000 --cmdline 'console=ttyO2,115200n8 mem=1024M androidboot.console=ttyO2 vram=20M omapfb.vram=0:16M androidboot.carrier=wifi' -o new_boot.img
When I use the tool to extract the CM10 boot.img, I get this:
mkbootimg --kernel kernel.gz --ramdisk initramfs.cpio.gz --base 0x40000000 --pagesize 4096 -o new_boot.img
cool.

[Q] "FAILED (remote: dtb not found)" error when flashing image on Xperia Z3

Hello,
I am facing error when flashing image on Xperia Z3. I rooted the device using the link posted on "theunlockr.com"
Now, I am trying to flash a new image on the device. I am extracting the exisiting image from the device, modifying the init.rc file and repacking the image (myboot.img) and then flashing it using fastboot method. This is when it gives me this error.
When I flash the original image that I extracted, it works fine.
I tried following methods: -
1. Changing init.rc file and repacking the .img file and flashing it
When I extract initrd.img (using abootimg), it shows me only these files ( I usually find init.rc file when I extract initrd.img but not in this device, is this expected?): -
- XZ3-AdvStkKernel_DooMLoRD_ramdisk.gz
- logo.rle
- init (linking to sbin/init.sh)
- sbin/bootrec-device
- sbin/ramdisk-recovery-cwm.cpio
- sbin/busybox
- sbin/ramdisk.cpio
- sbin/init.sh
I extracted sbin/ramdisk.cpio file to get the init.rc file using the command: -
cpio -idmv < ramdisk.cpio
After modifying the init.rc file, I repacked the cpio file using the command: -
ls | cpio -ov > ramdisk.cpio
I made sure that none of the extra stuff was not there in the folder before repacking the cpio file.
Now that my ramdisk.cpio file is updated, I created new image using the command: -
find . | cpio -o -H newc | gzip -9 > ../newramdisk.cpio.gz
and created myboot.img using abootimg
When I flashed this image file, I get the "dtb not found" error
2. Second method that I tried was I simply unpacked the boot.img (original image) and repacked it using abootimg in to myboot.img without changing anything.
This also gives the same error.
It looks like there is some issue with the unpacking and repacking of the boot image.
Is there any other way to resolve this issue?
asurion.acc said:
Is there any other way to resolve this issue?
Click to expand...
Click to collapse
use this instruction and tools, but when you will build your boot.img, use this cmd line
Code:
./mkbootimg --base 0x00000000 --kernel zImage --ramdisk_offset 0x02000000 --tags_offset 0x01E00000 --pagesize 2048 --cmdline "androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0xb7 ehci-hcd.park=3 dwc3.maximum_speed=high dwc3_msm.prop_chg_detect=Y" --ramdisk ramdisk.cpio.gz --dt dt.img -o boot.img
with that instruction all work fine. I've tested many times
Thanks for replying to me.
I just want to modify init.rc file to add few lines. The only file that I see is ramdisk.cpio which contains init.rc. I unpacked it , modified it and repacked ramdisk.cpio. Instead of creating new dt.img, I directly flashed the new img file onto the device and that soft bricked the device. :crying: The steps that you suggested mentions creating a new kernel and creating a new dt.img. Do I need to do that even though I just need to modify just init.rc file?
At this point, I am just trying to unbrick the device using flash tool. I tried cwmrecovery but it did not work so trying flashing tool now. once its done, if it is necessary to create a new dt.img and new zImage using toolchains, I will use that method. Please let me know if you think that is the step that I am missing which caused the device to brick.
Thanks a lot.
UPDATE:
Device is unbricked.!
I just need to root it again and follow the steps that you mentioned. Please confirm if I need new ZImage and dt.img even if I just need to edit init.rc.
Thanks a lot.

Categories

Resources