Related
I know some people have had a need to take apart a the boot.img file that mtd roms use, and I have been curious myself, so I wrote a bash script to do the job. The format of these files is as follows:
Code:
[
zImage[
kernel,
initramfs,
???
],
header (512 bytes),
boot,
recovery,
]
This script will split out the zImage, boot, recovery, and the initramfs from inside the zimage. These are all in gzipped cpio format. All three of those will be extracted into separate folders.
Instructions for use:
IMPORTANT: run this as root so permissions are preserved
Code:
tar -xf extract_boot.tar.bz2
./extract_boot.sh -b boot.img -o output_dir
Download link:
extract_boot.tar.bz2 - 1 KB
Thanks:
supercurio: Used some of his code from kernel_repack_utils to learn how to extract the zImage.
How to rebuild:
There is a script in the EpicCM repos that can rebuild a boot.img from the zImage, boot.cpio.gz, and recovery.cpio.gz.
Link: mkshbootimg.py
Thank you. I've been looking for this.
Sent from my SPH-D700 using Tapatalk
What am I doing wrong? I've tried extracting both cm7 and stock mtd kernels using this tool on android using terminal emulator. They both say syntax error.
Sent from my SPH-D700 using Tapatalk
xboxfanj said:
What am I doing wrong? I've tried extracting both cm7 and stock mtd kernels using this tool on android using terminal emulator. They both say syntax error.
Sent from my SPH-D700 using Tapatalk
Click to expand...
Click to collapse
This is meant for Linux. Something like Fedora or Ubuntu. Its a bash script, so it may still work on a phone it you run it in bash, but I doubt it.
Sent from my SPH-D700 using xda premium
Also, I think our boot.img's are a little weird.
sent from my always aosp epic
While you were figuring this out, I was getting this ready......
https://github.com/nubecoder/create_boot.img
Kernel devs should easily be able to make some use of it.
=]
nubecoder said:
While you were figuring this out, I was getting this ready......
https://github.com/nubecoder/create_boot.img
Kernel devs should easily be able to make some use of it.
=]
Click to expand...
Click to collapse
Oh you sneaky....
sent from my always aosp epic
zman0900 said:
I know some people have had a need to take apart a the boot.img file that mtd roms use, and I have been curious myself, so I wrote a bash script to do the job. The format of these files is as follows:
Code:
[
zImage[
kernel,
initramfs,
???
],
header (512 bytes),
boot,
recovery,
]
This script will split out the zImage, boot, recovery, and the initramfs from inside the zimage. These are all in gzipped cpio format. All three of those will be extracted into separate folders.
Instructions for use:
IMPORTANT: run this as root so permissions are preserved
Code:
tar -xf extract_boot.tar.bz2
./extract_boot.sh -b boot.img -o output_dir
Download link:
extract_boot.tar.bz2 - 1 KB
Thanks:
supercurio: Used some of his code from kernel_repack_utils to learn how to extract the zImage.
How to rebuild:
There is a script in the EpicCM repos that can rebuild a boot.img from the zImage, boot.cpio.gz, and recovery.cpio.gz.
Link: mkshbootimg.py
Click to expand...
Click to collapse
okay so...
extracting = CHECK
repacking = wtf???
how are you supposed to use the code from github? i dont see a way to download it so u can use as an executable text file and copying and pasting code into the teminal doesnt work.... how do i use it?
roddygonzo17 said:
okay so...
extracting = CHECK
repacking = wtf???
how are you supposed to use the code from github? i dont see a way to download it so u can use as an executable text file and copying and pasting code into the teminal doesnt work.... how do i use it?
Click to expand...
Click to collapse
Click the raw link in the upper right. That will give you plain text. You might want to check out what nubecoder did above, it could be easier to use.
Sent from my SPH-D700 using xda premium
nubecoder said:
While you were figuring this out, I was getting this ready......
https://github.com/nubecoder/create_boot.img
Kernel devs should easily be able to make some use of it.
=]
Click to expand...
Click to collapse
Nice! I've been working on a kernel and set up a similar build system for it in my github.
Some questions: how does mkbootfs work? It seems tovtake the place of cpio -o -c. Does it automatically set up the correct file permissions and ownership? If not, how are these being set? Last, is there source somewhere?
Sent from my SPH-D700 using xda premium
So do u have to make a zimage first and then make that a boot.img? I am so confused.
Sent from my SPH-D700 using Tapatalk
xboxfanj said:
So do u have to make a zimage first and then make that a boot.img? I am so confused.
Sent from my SPH-D700 using Tapatalk
Click to expand...
Click to collapse
Yep.
sent from my always aosp epic
So then where's the zimage maker?
Sent from my SPH-D700 using Tapatalk
xboxfanj said:
So then where's the zimage maker?
Sent from my SPH-D700 using Tapatalk
Click to expand...
Click to collapse
You compile it yourself..
sent from my always aosp epic
nubecoder said:
While you were figuring this out, I was getting this ready......
https://github.com/nubecoder/create_boot.img
Kernel devs should easily be able to make some use of it.
=]
Click to expand...
Click to collapse
This worked after a few fixes. The script references files without the ./ prefix in several places. This caused errors for me. I'm completely sure why, but I think it's because of my shell configuration change I had to make to install the codesourcery ARM toolchain.
After fixing it, it created the boot.img jsut fine, but the resulting image was too large to flash - around 7.6MB. Either the recovery or initramfs (I'm sorry I don't remember which one right now) you supplied is much larger than the one I was using and caused the increased size.
toadlife said:
This worked after a few fixes. The script references files without the ./ prefix in several places. This caused errors for me. I'm completely sure why, but I think it's because of my shell configuration change I had to make to install the codesourcery ARM toolchain.
After fixing it, it created the boot.img jsut fine, but the resulting image was too large to flash - around 7.6MB. Either the recovery or initramfs (I'm sorry I don't remember which one right now) you supplied is much larger than the one I was using and caused the increased size.
Click to expand...
Click to collapse
I think there's a lot of unnecessary parts in that initramfs, like the res folder and binaries in sbin. I think those should only be in the recovery. Check out my working initramfs in my github https://github.com/zman0900/android_kernel_epic4g_gb_mtd/tree/master/initramfs_mtd
So do the zimages inside the boot.img not have an intramfs? And if that's the case, I can probably just use the zimage that I got when I unpacked the cm7 kernel also when I repack, right? I'm updating intramfs and I know its in boot.img, but idk about zimage. Thanks.
Sent from my SPH-D700 using Tapatalk
xboxfanj said:
So do the zimages inside the boot.img not have an intramfs? And if that's the case, I can probably just use the zimage that I got when I unpacked the cm7 kernel also when I repack, right? I'm updating intramfs and I know its in boot.img, but idk about zimage. Thanks.
Sent from my SPH-D700 using Tapatalk
Click to expand...
Click to collapse
The zImage from cm7 won't work for a tw rom!
The zImage does have an initramfs. Mtd uses a two stage boot. So the zImage contains the kernel and a small first stage initramfs. The phone loads the zImage and starts the kernel, which then runs init in the first stage. That loads the second stage initramfs from the boot.img and executes its init, which mounts filesystems and handles the rest of the boot.
Sent from my SPH-D700 using xda premium
zman0900 said:
The zImage from cm7 won't work for a tw rom!
The zImage does have an initramfs. Mtd uses a two stage boot. So the zImage contains the kernel and a small first stage initramfs. The phone loads the zImage and starts the kernel, which then runs init in the first stage. That loads the second stage initramfs from the boot.img and executes its init, which mounts filesystems and handles the rest of the boot.
Sent from my SPH-D700 using xda premium
Click to expand...
Click to collapse
LOL. I know TW and CM7 kernels aren't compatible. Thank you very much for all the information though.
Umm...the zImage for tw WILL work for cm...its just the initramfs that changes, iirc
sent from my touchwiz 4.5-ed epic
I am currently on dxkp9 deodxed with bam kernel
Sent from my GT-I9003 using xda premium
Its a bug in the latest bam kernel
Cheers
Sent from my GT-i9003 powered by MIUI
it is not a bug if you flash custome kernel with cf-root, they removed the animation for faster boot time.
replace the bootanimation and samsungani at /system/bin with stock file.
change permission to rwxr-xr-x
replace the bootanimation.zip with ODEAnim.zip
change permission to rwxr--r--
you will get back the original boot animation. and you can not use custome boot animation anymore.
do with root expoler
good luck
Thanks for that suggestion still I am having the ssme issue , I am trying to have the nexus 5 animation its not working only the wave sound I can here :-(
Sent from my GT-I9003 using xda premium
Check your build.prop for this line:
debug.sf.nobootanimation=1
If it is there change it to:
debug.sf.nobootanimation=0
Then place a compatible bootanimation.zip file in /system/media/
See if this works.
arindammanidas said:
Check your build.prop for this line:
debug.sf.nobootanimation=1
If it is there change it to:
debug.sf.nobootanimation=0
Then place a compatible bootanimation.zip file in /system/media/
See if this works.
Click to expand...
Click to collapse
I coudnt find the line "debug.sf.nobootanimation=1" in my build.prop under /System folder
chongns said:
it is not a bug if you flash custome kernel with cf-root, they removed the animation for faster boot time.
replace the bootanimation and samsungani at /system/bin with stock file.
change permission to rwxr-xr-x
replace the bootanimation.zip with ODEAnim.zip
change permission to rwxr--r--
you will get back the original boot animation. and you can not use custome boot animation anymore.
do with root expoler
good luck
Click to expand...
Click to collapse
sorry,i noob.can u say detail?thx
akkrish85 said:
I coudnt find the line "debug.sf.nobootanimation=1" in my build.prop under /System folder
Click to expand...
Click to collapse
Add the following to ur build.prop:
debug.sf.nobootanimation=0
Then place a compatible bootanimation.zip file in /system/media/
See if this works.
Sent from my GT-I9003 using XDA
arindammanidas said:
Add the following to ur build.prop:
debug.sf.nobootanimation=0
Then place a compatible bootanimation.zip file in /system/media/
See if this works.
Sent from my GT-I9003 using XDA
Click to expand...
Click to collapse
sorry this also dint help
i have the same problem after flashing a new stock rom and new cf-root. But, why you don't install new CustomROM?
Its a bug, as stated by xda bam -.-
Cheers
Sent from my GT-i9003 powered by VurrutRom
This module will disable system write protection on the stock HTC One kernel.
To make /system writeable, you must install the module and then remount /system as rw.
For example:
insmod /system/lib/modules/wp_mod.ko
mount -o remount,rw /system
You can make an init.d script to load it, or add it to the boot.img. Either way will work, but it's important that this is loaded at boot, as attempting to make changes to /system and then installing this module could corrupt the partition.
This is mainly for devs, who are free to incorporate it into their ROMs.
Unless you are an advanced user, I would wait for it to be included in your favourite ROM.
A credit and a link here so people can thank me in the OP would be much appreciated
Download:
wp_mod.ko
Source code: wp_mod.c
Awesome mate... Thanks a lot
Thanks!
Quick question, do we need to install the module manually first before I create the init script?
wp_mod.ko for 3.4.10-gddcfb8c kernel version
wow ... new version from this mod ... thx :highfive:
ok ... installed wp_mod.ko to system/lib/modules ... make a new boot.img ... restart ... modified a file in system ... restart ... but changed file back original
ok ... next try ... i found the mod is kernel depends ... hexedit the mod to my kernel version ... installed ... modified a file ... restart ... and it works now, the file is well modified
thx @flar2
attached my modified wp_mod.ko only for 3.4.10-gddcfb8c kernel-version
use the attached with cwm-recovery, its only the modified wp_mod.ko file
The module should be placed somewhere on your /system partition, because that is what is mounted early in the boot process.
Kernel modules are usually located in /system/lib/modules/ but you can put it anywhere on /system
Then you can load it with an init script using the commands I posted above. Or you can put those commands in init.rc in the boot.img. Obviously the command has to be modified to reflect the location where you copied wp_mod.ko
You have to make sure that the boot.img is set to run init.d scripts, this is also done in init.rc.
Isotopes said:
wow ... new version from this mod ... thx :highfive:
ok ... installed wp_mod.ko to system/lib/modules ... make a new boot.img ... restart ... modified a file in system ... restart ... but changed file back original
ok ... next try ... i found the mod is kernel depends ... hexedit the mod to my kernel version ... installed ... modified a file ... restart ... and it works now, the file is well modified
Click to expand...
Click to collapse
Yes, it will only load if the version info matches.
If people don't know what that means, check your kernel:
uname -a
And make sure the module has the same string:
modinfo wp_mod.ko
You can change it with a hex editor as above, make sure you only change the characters of the version string and nothing else.
Good job mate
torxx said:
Good job mate
Click to expand...
Click to collapse
Really good job can you do the same file for the kernel? Thanks in advance
wp_mod.ko for 3.4.10-g87f8d97 kernel version
nikotine81 said:
Really good job can you do the same file for the kernel? Thanks in advance
Click to expand...
Click to collapse
and now, here the wp_mod.ko for 3.4.10-g87f8d97 kernel version
use the attached with cwm-recovery, its only the modified wp_mod.ko file
Isotopes said:
and now, here the wp_mod.ko for 3.4.10-g87f8d97 kernel version
use the attached with cwm-recovery, its only the modified wp_mod.ko file
Click to expand...
Click to collapse
Thanks i will test
Isotopes said:
and now, here the wp_mod.ko for 3.4.10-g87f8d97 kernel version
use the attached with cwm-recovery, its only the modified wp_mod.ko file
Click to expand...
Click to collapse
Works fine
Thanks
Nekromantik said:
Works fine
Thanks
Click to expand...
Click to collapse
fine is the wrong word, works perfect :good::good::good:
Hi! Just wanted to add additional info. Since the kernel source is out now you could also disable write protection by changing the line in
arch/arm/configs/m7_defconfig
Click to expand...
Click to collapse
from
CONFIG_MMC_MUST_PREVENT_WP_VIOLATION=y
Click to expand...
Click to collapse
to
# CONFIG_MMC_MUST_PREVENT_WP_VIOLATION is not set
Click to expand...
Click to collapse
referencing file
arch/arm/mach-msm/emmc_partitions.c
Click to expand...
Click to collapse
code
Code:
#ifdef CONFIG_MMC_MUST_PREVENT_WP_VIOLATION
if (!strncmp(ptn->name, "system", 6))
mmc_blk_set_wp_prevention_partno((int) ptn->offset);
#endif
on
Code:
void mmc_blk_set_wp_prevention_partno(int partno)
{
sprintf(wp_prevention_partno, "mmcblk0p%d", partno);
pr_info("%s: set wp_prevention_partno to %s\n", __func__, wp_prevention_partno);
}
EXPORT_SYMBOL(mmc_blk_set_wp_prevention_partno);
from
drivers/mmc/card/block.c
Click to expand...
Click to collapse
Works great thank you
Sent from my HTC One using xda app-developers app
Riyal said:
Hi! Just wanted to add additional info. Since the kernel source is out now you could also disable write protection by changing the line in
from
to
referencing file
code
Code:
#ifdef CONFIG_MMC_MUST_PREVENT_WP_VIOLATION
if (!strncmp(ptn->name, "system", 6))
mmc_blk_set_wp_prevention_partno((int) ptn->offset);
#endif
on
Code:
void mmc_blk_set_wp_prevention_partno(int partno)
{
sprintf(wp_prevention_partno, "mmcblk0p%d", partno);
pr_info("%s: set wp_prevention_partno to %s\n", __func__, wp_prevention_partno);
}
EXPORT_SYMBOL(mmc_blk_set_wp_prevention_partno);
from
Click to expand...
Click to collapse
Thank you, I discovered this months ago: http://forum.xda-developers.com/showthread.php?t=2059411. The reason for disabling it via a module is so people can continue to use the stock kernel. There are already custom kernels for this phone, but not everyone wants a custom kernel.
flar2 said:
Thank you, I discovered this months ago: http://forum.xda-developers.com/showthread.php?t=2059411. The reason for disabling it via a module is so people can continue to use the stock kernel. There are already custom kernels for this phone, but not everyone wants a custom kernel.
Click to expand...
Click to collapse
Only custom kernel is one from you at the moment.
Have to wait for more devs now.
The base version for the source code seems to be a older base, does that make a difference?
Nekromantik said:
Only custom kernel is one from you at the moment.
Have to wait for more devs now.
The base version for the source code seems to be a older base, does that make a difference?
Click to expand...
Click to collapse
It depends on what they changed.
I thought a couple custom kernels were posted in the trick droid thread?
flar2 said:
It depends on what they changed.
I thought a couple custom kernels were posted in the trick droid thread?
Click to expand...
Click to collapse
Only saw one other one but that did not work as it had issues with calls.
flar2 said:
Thank you, I discovered this months ago: http://forum.xda-developers.com/showthread.php?t=2059411. The reason for disabling it via a module is so people can continue to use the stock kernel. There are already custom kernels for this phone, but not everyone wants a custom kernel.
Click to expand...
Click to collapse
Nice! Never had a One X phone so wasn't aware of your mods :fingers-crossed:
If you're feeling adventurous here's a kernel to try:
http://goo.im/devs/flar2/One/Bulletproof-m7-0.1.zip
I don't have this device, so I couldn't test it. It might not work.
If the installer doesn't work, take the boot.img out of the zip and flash it in fastboot.
If the kernel won't boot, please send me /proc/last_kmsg. I might have to make some adjustments to the boot.img.
Don't install this unless you want to help me out with log files, etc.
hey guys I want to create a custom rom flashable in cwm I want to convert my nandroid backup to flashable zip but when i convert it doesn't have meta-inf only data, system and boot.img is there
.
I will use the meta-inf for my costom rom because i will copy some scripts in updater-script
.
Is there any options i will appreciate the one who can help me
jom23rd said:
hey guys I want to create a custom rom flashable in cwm I want to convert my nandroid backup to flashable zip but when i convert it doesn't have meta-inf only data, system and boot.img is there
.
I will use the meta-inf for my costom rom because i will copy some scripts in updater-script
.
Is there any options i will appreciate the one who can help me
Click to expand...
Click to collapse
You could find a way to
Flash system.img, data.img, and cache.img using scripts
then, use updater-script to copy those "scripts" that you want to
You could take a lil' help from here, http://forum.xda-developers.com/showthread.php?t=2266285, "reverse engineer" the tool for your requirements :angel:
THANKS
vineethraj49 said:
You could find a way to
Flash system.img, data.img, and cache.img using scripts
then, use updater-script to copy those "scripts" that you want to
You could take a lil' help from here, http://forum.xda-developers.com/showthread.php?t=2266285, "reverse engineer" the tool for your requirements :angel:
Click to expand...
Click to collapse
thanks for your help ill try that
________________________________________________
I APPRECIATE THE ONE WHO HELPED ME
________________________________________________
i misunderstand
vineethraj49 said:
You could find a way to
Flash system.img, data.img, and cache.img using scripts
then, use updater-script to copy those "scripts" that you want to
You could take a lil' help from here, http://forum.xda-developers.com/showthread.php?t=2266285, "reverse engineer" the tool for your requirements :angel:
Click to expand...
Click to collapse
I converted my nandroid backup into update.zip
.
The question now is
.
how can I flash system.img,data.img,cache.img to get those scripts for my updater-script?
U said flash system.img,data.img,cache.img using scripts
.
But i didn't have scripts?
.
I have a meta inf folder but updater-script is not edited because I didnt know what script I will put in this
.
Sorry i didnt understand how to get those scripts while I flash it
.
________________________________________________
I APPRECIATE THE ONE WHO HELPED ME
________________________________________________
jom23rd said:
I converted my nandroid backup into update.zip
But i didn't have scripts?
I have a meta inf folder but updater-script is not edited because I didnt know what script I will put in this
Click to expand...
Click to collapse
If you already have an update.zip that works, then, probably the existing updater-script flashes the system.img, data.img and cache.img... Could you please post the updater-script from the "update.zip" that you obatained :fingers-crossed:
I like modify all my ROMs, and in Android 5.0, the /system is on a system.dat and I don't know how to extract it, please help me
Up ?
I am up to this too. Before this .dat thing was very easy to de-bloat the ROM before installing it.
A different approach is to have a flashable zip with an updater- script that deletes apps / files and adds / changes etc. Its a bit more work at the beginning but it will save you editing every ROM zip you download as it'll only take a second to flash it.
rootSU said:
A different approach is to have a flashable zip with an updater- script that deletes apps / files and adds / changes etc. Its a bit more work at the beginning but it will save you editing every ROM zip you download as it'll only take a second to flash it.
Click to expand...
Click to collapse
Can you provide/point us a simple tutorial for making a simple flashable script that removes apps?
Thanks.
01 Vlatce said:
Can you provide/point us a simple tutorial for making a simple flashable script that removes apps?
Thanks.
Click to expand...
Click to collapse
I uploaded mine in this thread:
http://forum.xda-developers.com/google-nexus-5/help/editing-build-prop-via-flashable-zip-t2949308
Please note, it deletes some stuff, adds anything in the /system folder of the zip to your /system partition and also runs a bash shell script (.sh) to modify the build prop. If you look in the updater-script, you should be able to figure it out from there.
rootSU said:
I uploaded mine in this thread:
http://forum.xda-developers.com/google-nexus-5/help/editing-build-prop-via-flashable-zip-t2949308
Please note, it deletes some stuff, adds anything in the /system folder of the zip to your /system partition and also runs a bash shell script (.sh) to modify the build prop. If you look in the updater-script, you should be able to figure it out from there.
Click to expand...
Click to collapse
Already figured it out. Thank you!
you can also get an ext4 fs editor (the .dat is actually an ext4 image), such as ext4_unpacker and so on
http://forum.xda-developers.com/showthread.php?p=57633970