We have the Ava-Froyo 2.2 ROM with stock kernel (I think).
We got the source for the new kernel and re-compiled it with a flag we need.
We are trying to flash the kernel using "fastboot zimage c:\zImage" and "fastboot kernel c:\zImage" but neither work. We keep getting sending 'zimage'... OKAY then writing 'zimage'... FAILED (remote: not allowed)
We can't figure it out.
I ran unrevoked3 latest and set S-OFF and bootloader confirms it is S-OFF.
Why can't I write to flash/kernel??
How else can I flash a custom kernel?
I have ClockWork Mod 2.5.0.1 installed.
I only found one thing which said something about unrevoked's method makes you lose some of the advanced fastboot functions????
You can flash kernels from the clockwork recovery just like you would flash a rom. Just do it after you flash the rom of choice.
Sent from my PC36100 using XDA App
OK, but it looks like I can't just drop zImage on the SD and get CWM to flash it. It looks like I have to put it in an update.zip or something. Any ideas how to make one for my new zImage file?
Any other thoughts on how I could fastboot flash zimage w/out it complaining of out of memory or whatever?
Thanks in advance!!
why in the world are you doing it this way? simply create a flashable zip and flash it like you would a ROM
t3project said:
why in the world are you doing it this way? simply create a flashable zip and flash it like you would a ROM
Click to expand...
Click to collapse
+1 I agree with this guy. just create a flashable zip and voila.
Is this how you guys do that?
Step 7 - http://forum.androidcentral.com/htc...how-build-your-own-kernel-package-source.html
1. You probably don't have the eng bootloader that allows you to use fastboot.
2. Get any custom kernel in zip package, open it, delete everything you don't need and insert your zimage where the custom kernels zimage is. Keep the "kernel" and "META" directory and just replace your zimage in the kernel directory in the zip.
At the risk of sounding like an I ass I have to ask, how do you not know how to use fastboot or make an update.zip yet you managed to recompile the kernel? That one just goes over my head.
Well I didn't recompile the kernel, BUT I have re/compiled kernels for ~16 years so I know that part pretty well.
I just expected fastboot to work. I think my comment about unrEVOked borking fastboot is accurate then if you agree about the Eng loader.
I will grab a kernel zip and put that in. I saw these kernel scripts in one of them so I was thinking it is a lot of work to make that put, but what should my kernel script look like or do I really need one (this is in the .zip I update)..
IPvFletch said:
Well I didn't recompile the kernel, BUT I have re/compiled kernels for ~16 years so I know that part pretty well.
I just expected fastboot to work. I think my comment about about unrEVOked borking fastboot is accurate then if you agree and the eng loader.
I will grab a kernel zip and put that in. I saw these kernel scripts in one of them so I was thinking it is a lot of work to make that put, but what should my kernel script look like or do I really need one (this is in the .zip I update)..
Click to expand...
Click to collapse
I said it was at the risk of sounding like an ass and at least you came through and said you have re/compiled kernels before.
ENG bootloader would be my best guess as to why your fastboot is not working. I rooted with unrevo.forever and my fastboot works AFTER I replaced the bootloader.
If you use a zip package from a custom kernel like netarchy or kingklick the script is already there along with the scripts needed to install the kernel. You just have to place your zimage where that kernels zimage is and the scripts handle everything.
EDIT: I didn't make the zip but it should help you in the "write" direction (pun intended).
Examine the contents and the updater-script file.
How did you replace the bootloader after?
Ok so I got the HTC stock kernel 3.26 zip and I pulled out boot.img and replaced it with my zImage file renamed to boot.img. The update-script looks like it has no other major dependencies, the module is in the zip still, that stock one is Ok for me.
Code:
assert compatible_with("0.2") == "true"
show_progress 0.1 0
format BOOT:
copy_dir PACKAGE:system SYSTEM:
set_perm_recursive 0 0 0755 0755 SYSTEM:lib/modules
write_raw_image PACKAGE:boot.img BOOT:
show_progress 0.1 0
So.... here goes (via CWM Recovery)...
Crap what did I do wrong. It won't boot now, it goes into bootloader all the time.
Here's the zip I just tried...
IPvFletch said:
Crap what did I do wrong. It won't boot now, it goes into bootloader all the time.
Here's the zip I just tried...
Click to expand...
Click to collapse
Check my last post before this. You're problem is you tried to install it as a boot.img file and the boot.img file holds the system image as well as the kernel.
To install a kernel alone it has to be a zimage file and installed differently.
I pushed the original htc-froyo-stock-kernel-signed.zip kernel update just now and it is booting again.
Gonna guess something to do with the signed zip yet unsigned kernel boot.img?
How can I fix my zip with my new zImage?
lovethyEVO said:
Check my last post before this. You're problem is you tried to install it as a boot.img file and the boot.img file holds the system image as well as the kernel.
To install a kernel alone it has to be a zimage file and installed differently.
Click to expand...
Click to collapse
OK I kind of thought that but didn't know. I know boot.img is the whole boot partition not just the kernel image. doh. :]
Ok back to YOUR/koush kernel installer .zip...
The update-script has no mention of zImage though, so do I need to do more than just dump my zImage into this zip? EDIT: Guess so got error 6 it aborted.
IPvFletch said:
OK I kind of thought that but didn't know. I know boot.img is the whole boot partition not just the kernel image. doh. :]
Ok back to YOUR/koush kernel installer .zip...
The update-script has no mention of zImage though, so do I need to do more than just dump my zImage into this zip? EDIT: Guess so got error 6 it aborted.
Click to expand...
Click to collapse
Check the updater-script. You will see what happens in the process.
If anything, send me your files and I can test install them onto my system.
OK so it dumps system and kernel into temp folders. For kernel it goes through the entire folder and sets perms 4 of the 5 files (excluding zImage) and then runs dump_image. This I guess is smart enough to pick up zImage and dumps it all into a new boot.img. Then eventually it runs mkbootimg which takes zImage and the new boot image ramdisk and creates a new shell. Then it runs that shell.
I don't see why it fails though. I didn't put any modules in there but it looks like it doesn't need me to. I already have the latest versions of those kernel module files anyways.
lovethyEVO: Post 11, thanks!
So if I understand correctly, in post 11 you renamed the zimage to boot.img?
Just making sure so I know how to test it.
LOL oh yes that is that zip HAHA sorry.
No go through zip. Gave me status error 6 and because I use fastboot mostly I'm not sure how to correct it.
Flashed it through fastboot:
fastboot flash boot zImage.img = FAILED <remote: image error! <BootMagic check fail>
fastboot flash system zImage.img = OK but stuck at splash screen which I expected.
But now you have a general idea of what's going. It's possibly your kernel and maybe not just the zip file.
Can someone just put this zImage in a kernel flash zip for me? I will try later as well but clearly I'm not good at this.. :]
The zImage is in a .zip file attached. Thanks!
Related
Hi, since this is my wife's HTC hero from Orange UK, I'm being particularly careful with it. I'm new to xda-developers/HTC platforms (but not new to doing horrible things to embedded platforms) :>
I've been messing about with the phone all evening - downloaded that ROM image from the other thread and pulled it apart to look at the OS files etc - the standard break-a-new-embedded-linux-platform routine.
Anyway, if you hold down BACK when powering on, it enters the bootloader mode with a "FASTBOOT USB" prompt, which sounded interesting. I got a copy of the fastboot binary, and extracted the kernel and the ramdisk images from "boot.img" in the "HEROIMG_Hero_HTC_WWE_1.76.405.1_R3_WWE_release_signed.zip" (using split_bootimg.pl).
Just as a quick test, I tried booting them with:
fastboot boot kernel.img boot.img
since the above just boots a kernel from RAM, and not actually flash it. Anyway, fastboot claims it downloaded and booted it ok, and the phone shows the "HERO" logo. Unfortunately that is as far as it gets. However, if I reset the phone, it boots perfectly fine from the kernel/ramdisk in flash (phew!)
Since it doesn't actually boot into android proper (and doesn't show up as a USB device), I don't know if (a) its showing the HERO logo, but failing the signature check, or (b) actually booting, but crashing 'cos the kernel/ramdisk aren't quite right. I'd guess (a) myself, but I'm new to messing with HTC bootloaders.
Anyway, in case they're useful, the details of the phone from the fastboot mode are:
HERO CVT SHIP S-ON
HBOOT-1.76.0004 (HERO10000)
MICROP-010f
TOUCH PANEL-SYN0104
RADIO-6.35.04.25
Jul 3 2009,15:22:21
That method of entering fastboot is the same as the magic. Check the magic / sapphire wiki and have a read as I suspect the magic is its closest relative and a lot of the magic stuff will work...
daisy xx
Aha, thank you very much, that gives me more information!
Anyway, I just tried booting the boot.img itself instead of splitting it up with:
fastboot boot boot.img
This time, it booted right into the full android! Checking /proc/config.gz:
On the phone booting normally, it says:
# Linux kernel version: 2.6.27
# Fri Jul 3 07:52:06 2009
On the phone booted with boot.img extracted from that zip, it starts:
# Linux kernel version: 2.6.27
# Thu Jun 25 14:16:01 2009
So it seems as though it can boot the boot.img: AFAIK config.gz is hardcoded into the kernel binary. Now: is there a signature in the boot.img file?
Erm, I'm either hallucinating from lack of sleep, or I appear to have a root shell on it now. e.g. I can see the contents of /data from "adb shell":
ps reports: [snip]
root 43 1 3332 164 ffffffff 0000e8f4 S /sbin/adbd
root 619 43 748 340 c005ef5c afe0d08c S /system/bin/sh
# ls /data/app
org.oep.pong.apk
com.google.android.stardroid.apk
se.illusionlabs.labyrinth.lite.apk
com.google.zxing.client.android.apk
com.innovativelanguage.wordpowerlite.jp.apk
com.funambol.android.apk
com.massorbit.sword.apk
com.soundroid2012.piano.apk
jg.entertainment.abook.four.apk
com.maplekeycompany.apps.shake.apk
net.peterd.zombierun.apk
All I did was
1) pull the boot.img apart with split_bootimg
2) gunzip the ramdisk
3) hexedit the ramdisk to set ro.secure=0 (couldn't be bothered faffing about with cpio)
4) gzip the ramdisk
5) rebuild the image with mkbootimg. Oh you need to specify a different base address. Example command line:
/tmp/mkbootimg --kernel boot.img-kernel --ramdisk boot.img-ramdisk.insecure.gz --cmdline 'no_console_suspend=1 console=null' -o test-insecure.img --base 0x19200000
Then I just booted it with "fastboot boot test-insecure.img"
adq said:
Erm, I'm either hallucinating from lack of sleep, or I appear to have a root shell on it now. e.g. I can see the contents of /data from "adb shell":
ps reports: [snip]
root 43 1 3332 164 ffffffff 0000e8f4 S /sbin/adbd
root 619 43 748 340 c005ef5c afe0d08c S /system/bin/sh
# ls /data/app
org.oep.pong.apk
com.google.android.stardroid.apk
se.illusionlabs.labyrinth.lite.apk
com.google.zxing.client.android.apk
com.innovativelanguage.wordpowerlite.jp.apk
com.funambol.android.apk
com.massorbit.sword.apk
com.soundroid2012.piano.apk
jg.entertainment.abook.four.apk
com.maplekeycompany.apps.shake.apk
net.peterd.zombierun.apk
All I did was
1) pull the boot.img apart with split_bootimg
2) gunzip the ramdisk
3) hexedit the ramdisk to set ro.secure=0 (couldn't be bothered faffing about with cpio)
4) gzip the ramdisk
5) rebuild the image with mkbootimg. Oh you need to specify a different base address. Example command line:
/tmp/mkbootimg --kernel boot.img-kernel --ramdisk boot.img-ramdisk.insecure.gz --cmdline 'no_console_suspend=1 console=null' -o test-insecure.img --base 0x19200000
Then I just booted it with "fastboot boot test-insecure.img"
Click to expand...
Click to collapse
You're ready to build your own rom images ;-)
You could start by preparing your own rooted recovery with nandroid.
For a quick and dirty basic recovery image, just download one from sapphire development forum, replace the boot.img-kernel with a working copy for your hero.
Then rename init.sapphire.rc in init.hero.rc in ramdisk image.
You can simply extract ramdisk image with:
mkdir boot.img-ramdisk
cd boot.img-ramdisk
zcat ../boot.img-ramdisk.gz | cpio -idv
make your changes to ramdisk files
search internet for a script named repack-bootimg.pl
add the new base parameter to mkbootimg line in the script
cd to directory where you unpacked your boot.img
repack-bootimg.pl boot.img-kernel boot.img-ramdisk newboot.img
fastboot your recovery
then you can use nandroid in the recovery image to make a full dump of your rom and use the newer version of boot.img you have in your device to rebuild an up-to-date recovery or any kind of rom (you could start by preparing a copy of your original rom by changing ro.secure=0 in both boot.img and recovery.img).
By the way, I noticed that kernel in HERO uses sapphire fixup. The currently available version on the net is not booting on sapphire (magic) 32A, but it resets after a few minutes.
Maybe the kernel version in your orange hero introduces compatibility with sapphire boards. Well, really I suppose it won't, but if you get a nandrod backup and post your current original boot.img, magic 32A board owners could give it a try while we are waiting for HTC to release updated kernel sources for Magic and Hero.
Bye
daldroid
adq said:
[...]
So it seems as though it can boot the boot.img: AFAIK config.gz is hardcoded into the kernel binary. Now: is there a signature in the boot.img file?
Click to expand...
Click to collapse
No, no signature in standard boot.img, you have to zip it and sign the resulting zip. But no signing keys except for test-keys are available to the public, so I suppose your spl (S-ON) wil not allow you to directly flash rom images from fastboot command line.
However it seems your SPL allows you to fastboot a repacked boot image, so it should not be a problem to use a recovery image to flash whichever rom mod you like.
I suggest you not to flash any SPL you can find on the net, I suppose you have the newest ad no image of your original SPL is available (there is one from a leaked hero image, but yours seems to be newer)
Bye
Yeah, my thoughts exactly, I'd rather not flash the SPL if I can help it: I don't fancy explaining to my wife why I have to rip her phone apart to find the JTAG contacts I'll upload the boot.img later though.
Thats odd about the reset after a few minutes thing: hardware watchdog timer of some sort?
adq said:
Yeah, my thoughts exactly, I'd rather not flash the SPL if I can help it: I don't fancy explaining to my wife why I have to rip her phone apart to find the JTAG contacts I'll upload the boot.img later though.
Thats odd about the reset after a few minutes thing: hardware watchdog timer of some sort?
Click to expand...
Click to collapse
Well, really it's a little bit mor than a minute or so.
I suppose it's not an hardware watchdog, I don't have access to console debug messages.
Really the reset is a good sign, if you try booting dream or sapphire 32b kernel on 32A boards, it hangs forever.
If you extract piggy.gz from the kernel and hexedit it,you can find hero kerel initializes the hardware using the sapphire fixup.
It could only be that htc reused the same source and fixed hardware details and forgot to change the fixup routine name or that they are prepare to build a kernel able to boot on both hero and magic 32A boards.
32A and hero use the same new base address for kernel and ramdisk loading 0x19200000.
our boards have more memory than dream and 32b boards.
I suspect htc is using a stacked ram configuration and they changed the init code for the number of banks in memory.
In 32A they changed ram location for fb, ram console and maybe gpu1. It was a real mess to guess every change, so I stopped recompiling and rebooting the kernel after a dozen of times ;-) Waiting for htc to release the patched source code ;-)
The radio rom on hero seems to be is newer than 32a's latest available but I don't want to try a flash, you know what I mean ;-)
The available hero SPL shoud work on sapphire (and on blackstone and topaz too) and maybe the newer radio rom requires it, but... I prefer not to brick my Magic.
Have a nice rom rooting time. You could want to give superuser.apk a try.
People on this forum is asking for rooting status on hero, I suppose you'll be able to announce them your succes in a short time.
Wow! That was Fast! Lol..... even thought there is still some work to do.
i feel honoured to have been one of the first to read this i still dont have a hero yet =[ gotta wait till august when i get my ema might start scrounging and saving what i can get so i can get it sooner
Well done to you sir what a fine job uve done, gz =]
I'm waiting for my Hero as well and I'm completely new to android.
But like you I develop for and work with embedded Linux systems so tearing ROMs apart was pretty much on top of my list when my device should arrive .
I don't know what the 'recovery' image does on Android systems, but as I read it like this: You can temporary boot a rom (or at least a kernel and it will get the rest of the system from the rom area) through the fastboot method.
So yes, then you have temporary booted into a rooted ROM. But how to make it permanent? Because if you modify the ROM and flash it back it will probably not work because it detects its modified, right?
Trying to make a "dirty recovery image" to dump full roms using Nandroid Backup
Hello Dalroid,
I read your post and was able to do the following:
1. Using split_bootimg, extract the ramdisk files from the Stock HTC HERO Rom found in the XDA forums.
2. I downloaded the cm-recovery 1.4 image from Sapphire and used split_bootimg on it as well.
3. I copied the extracted kernel from the HTC Hero ROM and replaced the one from the cm-recovery of sapphire.
4. I renamed init.sapphire.rc to init.hero.rc in the extracted recovery image folder.
5. This is where i have trouble. I am using the repack-bootimg.pl, but I am unable to repackage the image.
I did note that you stated that some base parameters needed to be changed in the script for this to work. Could you please shed some light on what I need completed in order to repackage. Thank you in advance.
EDIT: I found one problem so far, I do not have mkbootimg or mkbootfs on my computer. How do I get these on my computer?
JWallstreet said:
Hello Dalroid,
I read your post and was able to do the following:
1. Using split_bootimg, extract the ramdisk files from the Stock HTC HERO Rom found in the XDA forums.
2. I downloaded the cm-recovery 1.4 image from Sapphire and used split_bootimg on it as well.
3. I copied the extracted kernel from the HTC Hero ROM and replaced the one from the cm-recovery of sapphire.
4. I renamed init.sapphire.rc to init.hero.rc in the extracted recovery image folder.
5. This is where i have trouble. I am using the repack-bootimg.pl, but I am unable to repackage the image.
I did note that you stated that some base parameters needed to be changed in the script for this to work. Could you please shed some light on what I need completed in order to repackage. Thank you in advance.
EDIT: I found one problem so far, I do not have mkbootimg or mkbootfs on my computer. How do I get these on my computer?
Click to expand...
Click to collapse
I built my mkbootimg from android source code (android.git.kernel.org), but if you prefer you can find a prebuilt binary from http://rapidshare.com/files/249629878/PortTools.rar. I'm not the author neither I tested it, just searched for mkbootimg in forums and pasted the link for you.
If you use the standard mkbootimg, just add --base 0x19200000 the the mkbootimg line, otherwise the boot.img will be generated with standard load address which won't work for hero (or for my 32A Magic).
This is pretty exciting stuff
I really want to remove the SIM lock from the Hero - is this something you can do now you've got su access?
Is it going to be possible to have a 'how to' guide for the Hero to tell us what to do to get the phone unlocked?
I want to see someone install the Magic image on the Hero - it should fly with the extra RAM
Just out of curiosity, what would happen if I booted the original cm-recovery-1.4.img on the Hero?
My phone will hopefully arrive tomorrow, and the first thing I'd like to do is create a backup with the nandroid script.
wossName said:
Just out of curiosity, what would happen if I booted the original cm-recovery-1.4.img on the Hero?
My phone will hopefully arrive tomorrow, and the first thing I'd like to do is create a backup with the nandroid script.
Click to expand...
Click to collapse
It wont boot. You can instead use the modified(only trackball press event and kernel) cyanogen's recovery here: http://forum.xda-developers.com/showthread.php?t=541807&page=2
enlightener said:
It wont boot. You can instead use the modified cyanogen's recovery here: http://forum.xda-developers.com/showthread.php?t=541807&page=2
Click to expand...
Click to collapse
I'm new to all this, so I'd be grateful for some more information: is the Dream and Hero hardware too different to boot the same image? Or would it be possible to create multi-platform images?
I already downloaded the modified image from that thread and have extracted the same kernel, so I should be all set.
Original post:
Hello,
I am new to android but not to linux. I used to tweak my winmo phone rom.
I have backed up my device with nandroid. I just need some explanations:
- why isn't the radio extracted?
- how can I "extract" does .img files to modify and then rebuild them?
I found some informations of what the .img files contain here: ROM Partitions it should be the same for Hero
I have found some informations on how to push updates to the rom by looking at modaco updates. It seems quite simple to delete/copy files on the hero rom using an update-sript file. I am however curious about the RSA cert and if some files need to be signed.
Any information welcomed.
Regards
Click to expand...
Click to collapse
How to
Extract NAND image files
To extract .img files, I have found unyaffs from http://code.google.com/p/unyaffs/ I have compiled it under ubuntu 64 (attached). Unyaffs works on system.img but on no other .img file
To extract boot.img use attached extract-kernel.pl and extract-ramdisk.pl
# extract-kernel.pl boot.img
# extract-ramdisk.pl boot.img
Should work for recovery.img but haven't tried as custom recovery images on the forum are great.
Rebuild system.img
Seems you just need "to loopback mount an image on your linux box and format it with YAFFS".
But it is useless as because Hero's SPL does not allow flashing system.img directly. You should use an update.zip package for that. (read below)
Rebuild boot.img
After extracting your boot.img using attached extract-*.pl and tweaking it, in 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
Creating an update.zip package
Creating an update.zip package is quite easy in fact. For example, to add a (valid) test.apk package to your rom:
- create an empty folder <workdir>
- create folder structure for test.apk (<workdir>/system/app) and copy the test.apk
- create folder structure for update-script (<workdir>/META-INF/com/google/android)
- edit <workdir>/META-INF/com/google/android/update-script
- put in it:
Code:
show_progress 0.1 0
copy_dir PACKAGE:system SYSTEM:
set_perm_recursive 0 0 0755 0644 SYSTEM:app
show_progress 0.1 10
- compress the <workdir> content to zip (not the <workdir> folder itself)
Now you are going to sign the zip file. Download attached testsign.zip and copy it in your <SDK>/tools folder. Extract it here. It should create a sign subfolder with a testsign.jar file in it.
Then, from <workdir> folder, do:
java -classpath <SDK>/tools/sign/testsign.jar" testsign file.zip file-signed.zip
Ok, now your zip file is ready to be deployed using cyanogen recovery image.
To find more command to use in update-script, look at other's.
Modify .apk package
Seems it is easy to uncompress an .apk package (zip) an to modify files in it and then compress it. But after all: you must sign it like update.zip packages.
ODEX files
- What are those Odex files? Answer.
- How to get rid of them?
Odex files depend on framework they are made for. To deodex an odex file use that how to
Then you may create a classes.dex file by executing the smali program on the "out" folder. You then rename it to classes.dex and add it to the .apk.
- How to create them?
Use dexopt-wrapper on device.
Porting an other device's rom
Well, that part is easy
- extract the system.img
- extract boot.img
- replace boot.img-kernel with the one from your stock Hero rom one.
- rebuild boot.img
- build update.zip package (look someone's hero custom rom to see how to do it)
- sign and flash
It should run place and make calls but probably won't have Wifi, BT, trackball support. If you make those work: tell me, but I think we should wait to be able to compile a 2.6.29 kernel to have those.
Tools
Androsign script (linux)
I wrote that androsign script to quick sign zip files. Just put it in your <SDK>/tools folder, then chmod +x. If you have put the tools folder in your PATH, you can call it directly like this:
androsign /dev/folder1/folder2/update.zip (or any zip/apk file)
It will output an update-signed.zip (or app-signed.apk etc) in the same folder than original file was in.
Notes
Note1: thanks
Thanks to every guy that helped me found all that.
Note1: sharing
I searched for hours, so I am more than happy to share it to save someone's time. I am just disappointed than some people here do not have that spirit: I could have use those hours for development instead of research...
Note3: corrections
So, if you found anything incorrect, would like to supply more informations or want to correct my bad english: just PM me.
To find
- how to dump radio from device
- how to build a custom hero kernel (waiting for HTC sources)
To come
How to prepare your own kitchen and useful scripts (linux)
gecka said:
I am new to android but not to linux.
Click to expand...
Click to collapse
Same here. I do lots of tweeking on my linux machine, so i know quite a lot of linux. If there would be anyone to answer those questions by gecka, I might start tweeking the rom (maybe someday cook one up)
Best regards
Hello,
First post edited, but still some ignorances... Please share if you know anything.
Best regards
unpack and pack boot.img and recovery.img
First you need utilities such as mkbootfs and mkbootimg. maybe you can find them online (i can upload them later compiled for linux x86-64) but i suggest you download android source (http://source.android.com) and do a generic make. In this way you have these and other utilities(tools to pack system.img too, but if you haven't an engineering bootloader you can't flash it directly) in /out/host/... (it's better if you add this in your PATH)
To unpack and pack boot and recovery, read here:
http://forum.xda-developers.com/showthread.php?t=443994
or here:
http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
...or...
(I have attached extract-kernel and extract-ramdisk scripts from JF build environment) :
to unpack (boot.img or recovery.img, i'm writing the commands with boot.img):
Code:
extract-kernel boot.img
extract-ramdisk boot.img
at this point you have
boot.img-kernel
boot.img-ramdisk
to repack (boot.img or recovery.img):
For hero you need to specify the base address because it's different (0x19200000). For more information: http://forum.xda-developers.com/showthread.php?t=541522.
Code:
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
Useful resources for android modding are the dream forums (most of the concepts/hacks works for hero too):
http://forum.xda-developers.com/forumdisplay.php?f=448
(informative thread here: http://forum.xda-developers.com/showthread.php?t=519523)
note: mkbootimg with --base support is in donut and master (or find the patch on gerrit and apply it to cupcake)
First of all, the reason you cant unyaffs anything other than system.img is because they aren't YAFFS images. boot/recovery is kernel+initrd like in any normal linux bootimage scenario (see more below).
Tofind
- how to dump radio from device
Click to expand...
Click to collapse
Haven't gotten into that myself yet, but I know modaco posted an update.zip with radio image included on this very forum. Look for it.
- how to extract NAND images other than system.img
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?t=443994
- rebuild NAND images such as system.img
Click to expand...
Click to collapse
This isn't hard, just loopback mount an image on your linux box and format it with YAFFS.
Building a custom kernel and recovery binary
HTC hasn't yet released the changes they have made to the hero/dream/magic kernels, 32A board, so you can't just compile a kernel from the AOSP. I haven't tried it yet but this patch might work on hero too:
http://forum.xda-developers.com/showthread.php?t=548061
EDIT: HTC Sources for dream and magic at http://developer.htc.com
For building a custom recovery, it's better if you use cyanogen's recovery code, found in his git : github.com/cyanogen, because it already has menus for nandroid and other tools, but you can use the recovery code from AOSP too (cyanogen's one is a patched version with a lot more features, http://forum.xda-developers.com/showthread.php?t=523558). To make a custom recovery you need to change the recovery binary (because the press event of the hero trackball has a different keycode, 191), the kernel and the init scripts. Actually i don't remember what else I've changed to make cm's recovery working with hero (the recovery that we are actually using here), I'm at work now, but i'll check later and post more details, or you can just unpack the recovery and see the changes .
First post updated.
Nandroid only backs up the partitions in the main storage nand, but radio and spl are flashed to the radio's own nand flash. Whether it's possible to dump it or not I don't know, but honestly, I don't see why you'd want to. Radio images are available through RUU's and I don't think editing would be an easy task
jubeh said:
Nandroid only backs up the partitions in the main storage nand, but radio and spl are flashed to the radio's own nand flash. Whether it's possible to dump it or not I don't know, but honestly, I don't see why you'd want to. Radio images are available through RUU's and I don't think editing would be an easy task
Click to expand...
Click to collapse
Sometimes, new radio images appear on new phones. That is why I am looking on a way to extract it.
very useful thread.
Very nice tutorial, thank you!
could you please specify a bit more on how to clone from android's git and then build the mkbootimg and mkbootfs (just make, right)? I tried and I keep getting a "fatal:server dumped connection" error
Are we able to modify an official ROM (also for hero). Which shows up in RUU as INFOsignature checking... failed. Am I able to change the kernel and make it work?
jubeh said:
could you please specify a bit more on how to clone from android's git and then build the mkbootimg and mkbootfs (just make, right)? I tried and I keep getting a "fatal:server dumped connection" error
Click to expand...
Click to collapse
What command do you use?
In fact i won't be able to explain you better than that page: http://source.android.com/download
Following that how to, you'll be able to sync an android branch You can learn more about git, branches and more here (Repo and Git resources)
The sync is long (2.9Go). Then, to build mkbootimg and mkbootfs, you should do a generic build of android going to source folder and issuing the 'make' command.
All that will be part of my upcoming "How to prepare your own kitchen and useful scripts".
awsy44 said:
Are we able to modify an official ROM (also for hero). Which shows up in RUU as INFOsignature checking... failed. Am I able to change the kernel and make it work?
Click to expand...
Click to collapse
Well, to grep the system from a windows RUU exe file you should launch it and then look in your user temporary folder for a rom.zip file in a {uid} subfolder. It contains the system and boot img files.
You then need to make an update.zip package from them. Have a look to someone's hero custom rom and to it's update-script to see how it is achieved. My 'How to' gives you all you need to understand update.zip packages and to extract system.img.
If you are porting a Hero rom, no need to change the kernel.
Regards
Well, to grep the system from a windows RUU exe file you should launch it and then look in your user temporary folder for a rom.zip file in a {uid} subfolder. It contains the system and boot img files.
You then need to make an update.zip package from them. Have a look to someone's hero custom rom and to it's update-script to see how it is achieved. My 'How to' gives you all you need to understand update.zip packages and to extract system.img.
If you are porting a Hero rom, no need to change the kernel.
Regards
Click to expand...
Click to collapse
Thanks so much for this amazing information, however how do i stop getting hit with the infosignature failed error? is that the kernel or the hboot? it says 12 signature verify error.
Oh, I do have the source and I am running my own donut build on my dream with some of my spice, but the problem I was having was cloning that exact project (mkbootimg) from android.git.kernel.org using git, but when I read what you said, I remembered that when you make the build, it also compiles several tools and i overlooked checking the out folder for it, kind of dumb on my part since I had already pulled the fastboot tool from that build and added it to my own bin, i guess mkbootimg and mkbootfs should be there too, right?
i tried running androsign and got this error
Code:
[email protected]:~/android/dev/sdk/tools$ ./androsign META-INF.zip
Exception in thread "main" java.lang.NoClassDefFoundError: testsign
Failed!
[email protected]:~/android/dev/sdk/tools$
if i use a ROM of one device on an other different device, I think I must build a kernel on my own, is that correct?
but what config should I use? a config from my current running ROM? then I think I must make it suitable for new ROM, what options should I care about?
for example, if I want to run a AOSP 2.01 ROM ( system.img) on a Magic 32A device with SPL 1.76, and now I am running a SenseUI ROM which kernel is 2.6.27, I think I should build a 2.6.29 kernel from the git tree, and ensure it will work with camera/bt/wifi/trackball of my device properly first .
how can I make this step successful?
other hand, the dynamic lib files(.so) with the system.img can be incorrect. so, I may need to build them too for pairing with the kernel I built in previous step. I think applications will work properly because they only care about if the interfaces of kernel and lib is correct. for that, also there some config job (like build.prop, etc) to do, is there a list of all of these jobs? and what values can I refer to? the original ROM (Magic 32A SPL 1.76 working ROM here) ?
am I right? what should i do and what are in those steps? are there some doucments I can read from?
Thanks for the good summary. Just one question, where did testsign.jar come from? I'd like to get the source. Thanks!
JackZero said:
Thanks for the good summary. Just one question, where did testsign.jar come from? I'd like to get the source. Thanks!
Click to expand...
Click to collapse
Read this !
http://www.androiddevelopment.org/tag/apk/
;-)
I have just edited the AnyKernel updater script by koush to work with eMMC devices :-D
hope ppl can make use of this
its very simple
1) grab the .tar.gz file
2) extract
3) add the zImage to the /kernel/ directory
4) add .ko modules to /system/lib/modules/ directory
5) **optional** change the boot partition location in the updater-script (not normaly needed)
6) zip up the file
7) its ready to flash in CWM
Credits
Koush for the original boot unpack / repack bin's and scripts
IEF for the stand alone dd binary
what does it do?? sorry
does it make so you can update thru your network?
Thank you! This will be useful to me.
Nice, this is exactly what we needed.
Sent from my HTC Vision
Thanks!! I can finally make an Update.zip for my kernel!
nice work.
Now any kernel devs. can easy make a update.zip
G1_enthusiast said:
what does it do?? sorry
does it make so you can update thru your network?
Click to expand...
Click to collapse
Classic...lol
Why do ppl who have no clue even post stuff like that?
Thanks Apache this will come in handy.
Sent from my HTC Vision using XDA App
any chance to rip bootimg.cfg through the zip file?
since somehow I tried to get the cfg file from the boot.img but seems the boot.img and zImage in some kernel are the same.
Okay, so I have created and modified my own kernel name BionicSheep and have done couple releases (check my signature for link). My main question is how do I create a flashable zip with a boot.img I have asked a few people and they told me to use the kernel kitchen or google, but this is the only problem I haven't been able to solve after googling daily for the past 4 days. I figured I would ask here.
The reason I would like a boot.img is because I know in order to modify the kernelsplash with my own logo, I need to be able to unpack the bootimage to get the ramdisk and modify an rle file. The problem is I have no idea how to first make this bootimage. I understand to make the bootimage you need a the zImage (kernel binary) and the ramdisk. I have the zImage but I don't know how to make/get a ramdisk.
Currently I have been using this described method of packing my kernel into a flashable zip. I am pretty sure it just packs my modules and zImage into koush's AnyKernel. Thanks for any help, I need it.
Also try my kernel out and leave feedback if you are so inclined! It really is appreciated
Hi there! I'm trying to build CM-12 for GT-I8160 based on TeamCanjica's CM-11. Actually, it has been compiled successfully with some hacks (I skipped imgdiff). But it bricked my phone after I flashed it via CWM. :crying:
I've unbricked my phone by flashing my backup of stock boot partition (mmcblk0p15) to "Kernel" partition via Heimdall. Then, my phone showed CM boot animation for a long time. (bootloop I think, maybe because of stock boot partition isn't compatible with it). And I use stock firmware for now.
I found that type of the boot partition (mmcblk0p15) of the stock differ with boot.img I've built.
Code:
$ file mmcblk0p15-boot (my backup of stock boot partition)
mmcblk0p15-boot: Linux kernel ARM boot executable zImage (little-endian)
$ file boot.img (boot.img I've extracted from cm-12-20141217-UNOFFICIAL-codina.zip)
boot.img: Android bootimg, kernel (0x40008000), ramdisk (0x41000000), page size: 4096
So, what are "Linux kernel ARM boot executable zImage" and "Android bootimg"? Where is the root partition (ramdisk) stored?
Is it okay to skip imgdiff? I think imgdiff is just for creation of OTA package. Am I correct?
I also found boot.img in out/target/product/codina (not in the zip file) which type is Linux kernel ARM boot executable zImage.
Is it the correct boot.img? I found that the content of that file is same with kernel file I found in the same folder. I'm afraid that the ramdisk is not included in it.
Sorry for my English n thank you very much.
Oh. All people wants to have cm12, but still 0 replies here.
I'm sorry, I can't help in this too... /
S.AMU said:
Oh. All people wants to have cm12, but still 0 replies here.
I'm sorry, I can't help in this too... /
Click to expand...
Click to collapse
Hi! It's okay, I've flashed out/target/product/codina/boot.img + gapps. It booted to CM-12 , freezed at the welcome screen n refused to boot again after I force-rebooted it :crying:. Unfortunately, ADB & recovery didn't work, so I didn't know much why it got freezed. Maybe I have to figure out how to compile a nice kernel with working ADB & recovery. Hahaha...