[KERNEL] About flashing kernel for all Roms - HTC EVO 3D

Hi,
Because i like to test many different Roms with kernels, i created my own script to flash properly with the recovery.
Often, the Kernels are available for a Rom in particular, in a zip file containing a boot.img with the kernels modules contained in /system/lib/modules
The problem is that to start, Android does not need that kernel, but also the image of a micro file system (zImage) containing startup instructions, but also a list of parameters to pass to the kernel.
The boot.img is the concatenation of the kernel with its startup parameters, and zImage.
To properly replace a kernel, so we need to retrieve the current settings, the current zImage, and reform the boot.img with the new kernel, and of course, replace the modules.
This recovery script make these step:
- Extract the kernel from the boot.img file
- Get the boot parameters of actual kernel.
- Get the actual zImage
- Rebuild the boot.img with new kernel, old boot parameters, old zImage
- Replace the modules in /system/lib/modules
- Flash the new boot.img
Before do that.
Download the kernel from other Rom, you want to flash
Extract from the zip file, boot.img and /system/lib/modules directory
Get my kernel_flash.zip
Extract it.
Replace the system/lib/modules content with the new one.
Replace the boot.img with the new one.
Rebuild you zip file with 7zip (www.7zip.org)
This zip file containing:
META-INF
boot.img
kernel
system
version.txt
And flash it under recovery.
I tested these method with Senses Roms, with AOKP or AOSP Roms. Always in my system started succefully.
You should be able to flash this kernel on any ROM (except the boot stock that has an offset of 256 bytes incompatible with the script)
As is, this kernel_flash.zip file contains a yoda kernel 2.1, overclocked to 1.5 Ghz, you can test with your ROM.
Sorry for my english.
Thank you to Google for translation assistance
Thank you for the kernel to yoda (my kernel_flash.zip contain 3.0.16-yoda_v2.1)
Thank you to all XDA developers who allowed me to further my understanding

looks promising, but does this work also for s-on users ? i dont know if you knew this already, but there is https://play.google.com/store/apps/details?id=com.joeykrim.flashimagegui&hl=en this app in playstore, which works for both s-on and s-off users, and also flashes recovery

gav-collins1983 said:
looks promising, but does this work also for s-on users ? i dont know if you knew this already, but there is https://play.google.com/store/apps/details?id=com.joeykrim.flashimagegui&hl=en this app in playstore, which works for both s-on and s-off users, and also flashes recovery
Click to expand...
Click to collapse
For s-on:
After flashing kernel under recovery, only /system/lib/modules files are copied
Keep in Recovery,
You need to flash the kernel with fastboot.
Open a terminal
with adb, pull the boot image:
Code:
adb pull /tmp/newboot.img boot.img
Restart in fastboot mode
Code:
adb reboot bootloader
Flash the boot.img file
Code:
fastboot flash boot boot.img

fxjumper said:
For s-on:
After flashing kernel under recovery, only /system/lib/modules files are copied
Keep in Recovery,
You need to flash the kernel with fastboot.
Open a terminal
with adb, pull the boot image:
Code:
adb pull /tmp/newboot.img boot.img
Restart in fastboot mode
Code:
adb reboot bootloader
Flash the boot.img file
Code:
fastboot flash boot boot.img
Click to expand...
Click to collapse
would it flash the kernel if you are using 4ext recovery ?

Pacattack said:
would it flash the kernel if you are using 4ext recovery ?
Click to expand...
Click to collapse
My phone is S-OFF
4ext recovery flash the kernel.
I know 4ext dispose a S-ON mode to flash the boot.img on the first boot, but i don't know if it works in this case.
Try it

Related

Compile Kernel Issue (zImage Won't Flash)

I'm having trouble flashing a kernel. I've compiled the 2.3.4 kernel (faux's kernel, and i'm using ken's 2.3.4 ROM) and i am trying to fastboot the resulting zImage to my device with no luck. i keep getting either an error, or no action at all.
using the below command, the image is sent, bootloader mode, but just sits there forever.
Code:
fastboot boot zimage zImage
and below just gives an error such as FAILED: 0x30003000.
Code:
fastboot flash zimage zImage
i've searched the forum and see talk about needing the ramdisk, but i'm new to that. my nexus one i was able to just flash the zimage directly after compile with no ramdisk with it.
however i did give the ramdisk a shot. i took my nand backup, pulled the boot.img from it. then broke that up with an extract perl script i found from google, got the resulting ramdisk, which actually looked like the same size as the HKTW ramdisk, both at 152kb. but alas, i just get a boot loop when i use the ramdisk with the following command:
Code:
fastboot flash:raw boot zImage ramdisk.gz
so i'm kinda stuck here and hope someone could give me a pointer. thanks!
i had this while trying to flash xoom's kernel
Sent from my MB860 using XDA App
interesting so you think there is no solution and it has something to do with tegra devices? i can't imagine it's impossible else how are we making custom ROMs!
anyone else have hints? i doubt recovery matters, but i'm using CWM. i even tried wiping dalvik cache before the flash. since fastbooting a kernel doesnt use recovery but the bootloader, recovery prob does not matter either way.
anyone have the ramdisk they could send me? i'm using 2.3.4 ken's ROM. maybe i just goofed on extracting the ramdisk myself.
anyone have any additional advice or tips on the kernel zimage and flashing it to the atrix? i'm at my wits end here. i've tried for 5 days everything i could think of and just CANNOT flash the kernel that i compiled.
i also compiled it about 30 times thinking something screwed up. but seems like i just cant flash it to device. thanks.
use cwm? thats how I flashed the kernel. went perfectly.
also, are you unlocked?
Stephen Who said:
use cwm? thats how I flashed the kernel. went perfectly.
also, are you unlocked?
Click to expand...
Click to collapse
Well this is a zimage because I compiled the source and that's what's giving me trouble flashing to the phone.
I'd have to bundle into a flashable zip to use CWM and I need the ramdisk to do that.
Yes I'm unlocked.
Movd to proper section
Here is a (roundabout) way:
Not sure if you found an answer - but here is a roundabout way:
Start with an existing CWM kernel zip file and extract the boot image off it. Then follow the instructions here:
http://forum.xda-developers.com/showthread.php?t=443994
to get the ramdisk from the image.
Now - since you compiled your own kernel, assuming you know your way around Linux - you might need to adapt the command to match your linux installation, paths, etc.
Also - You might want to use moto-fastboot instead of the stock android fastboot:
Code:
sudo moto-fastboot flash:raw boot zImage mynewimage.img-ramdisk.cpio.gz
where zImage is the zImage compiled by you, and the ramdisk.cpio.gz is the ramdisk you extracted. This is how I load my own kernels onto my Atrix - and has worked for me. I just use a standard ramdisk image - makes life easier
Cheers.

cant get restore to boot

Was running cm10 did a a wipe and restored to previious rom, and it won't boot.. Just boot loops.. Anyway to get my phone working again> I can access recovery still
most likely an s-on issue, you need to flash the kernel separately in fastboot. it has to match your backup's rom base
om4 said:
most likely an s-on issue, you need to flash the kernel separately in fastboot. it has to match your backup's rom base
Click to expand...
Click to collapse
Can you go in detail for me please
You need the boot image from the Rom you made a back up of, it has to match the base at the time of the backup 1.22, 2.13 or what have you and it needs to be flashed in fastboot. To do so you need the mini SDK (adb tools) or the full sdk. Place the boot.img (kernel) into the directory and open a terminal. Navigate to the directory or open it directly in the folder (windows) by holding shift and right click and slecting open command window here. You then boot to bootloader and connect the phone in fastboot. Type devices to make sure its connected and then fastboot flash boot boot.img and reboot
Easiest way is download flashgui and then download meanrom and open up meanrom via flashgui on phone and flash the stock kernel then boot into recovery and then flash your.restore and wala!!! That's what I had to do being s on
Sent from my EVO using xda app-developers app

[Q] Custom Kernel for Desire 200 - How to include modules?

I have compiled a custom Kernel for my HTC Desire 200 unit from htc's source. After my kernel is compiled i get a zImage file. I then use Android Image Kitchen, to take a standard boot.img file and unpack it, replace the original zImage in it, repack and flash it via the fastboot command: "fastboot flash boot boot.img"
Fastboot then flashed the kernel, i reboot the phone and it boots and works to some extend. The changes i make is there (as an example, i can see the name change i have made in the kernel version), however WiFi is not working on the device with this custom kernel, and i believe this is because i need to somehow install the devices needed modules along with the kernel.
And heres my question. How can i create a zip file, that i can flash from Clockwork Mod recovery, that flashes the kernel, along with placing the modules where they belong? OR bundle the modules with a boot.img file that i can flash from fastboot ?
Basicly what i have i a zImage and modules, but i need to bundle it together for easy flash either via recovery (zip) or fastboot (img)
Can you assist me?
Quite surprised that this seems unsolvable yet also seems to be a thing every kernel developer has been dealing with ..

How to use ramdisk extraction utility to flash TWRP

Hey guys,
I consider myself pretty switched on but I can't understand how exactly the " ramdisk extraction utility" is used to flash TWRP.
Correct me if I'm wrong but it is used to unpack a boot.img file into separate files, one of which is the recovery. It then repacks it and allows it to be flashed via "fastest flash boot boot.img"
Ive found tools that repack boot.img files but all appear to be for Linux.
Can someone assist me by guiding me to a tutorial or offer step by step instructions on flashing TWRP onto my z2?
Basically all I want to do is understand how to flash any recovery I want when running a custom rom.
P. S - can someone explain the concept of why it dosnt work when I try to install TWRP as described in their website with
*terminal emulator or in adb shell:
su
dd if=/sdcard/fotakernel.img of=/dev/block/platform/msm_sdcc.1/by-name/FOTAKernel
Thank you.
Nothing guys?
Im not sure how to help you
1. Install fastboot
2. Use fastboot to flash recovery
Fastboot flash recovery recovery.img
3. You need a custom kernel
4. Find a kernel that supports fotakernel(recovery partition fyi)

how to flash a custom kernel?

I'm a noob.i wanna try out a custom kernel but i got no idea what steps to follow
Backup Boot-Partition with TWRP
Install another Kernel, whipe cache and dalvic
Boot Device
Restore Boot-Partition and the new Kernel is gone / whipe cache and dalvic
Boot Device
https://www.youtube.com/watch?v=rKHswG2Nytw
Ashiq.makkar said:
I'm a noob.i wanna try out a custom kernel but i got no idea what steps to follow
Click to expand...
Click to collapse
1. make sure the kernel of your choice SUPPORTS your DEVICE, flashing wrong kernel means BYE BYE POCO
2. using custom Recovery like twrp/blackpitch/orangeFox etc just flash the Kernel.zip file! and wipe cache/delvik
3. flash Magisk19.3 if you wana root your device!
however we don't flash kernels via fastboot but for your knowledge if you extract the kernel.zip and take the img file from inside and place it in
C:\Program Files (x86)\Minimal ADB and Fastboot
open adb command window and flash kernel with this command
Code:
fastboot flash boot kernel.img
will flash the kernel in /boot section
later you can install mangisk manager and PATCH the boot.img
see METHOD 2 https://www.thecustom droid.com/install-magisk-root-android-devices/
however 99% fellows here uses twrp! its easy and popular!
YasuHamed said:
1. make sure the kernel of your choice SUPPORTS your DEVICE, flashing wrong kernel means BYE BYE POCO
2. using custom Recovery like twrp/blackpitch/orangeFox etc just flash the Kernel.zip file! and wipe cache/delvik
3. flash Magisk19.3 if you wana root your device!
however we don't flash kernels via fastboot but for your knowledge if you extract the kernel.zip and take the img file from inside and place it in
C:\Program Files (x86)\Minimal ADB and Fastboot
open adb command window and flash kernel with this command
will flash the kernel in /boot section
later you can install mangisk manager and PATCH the boot.img
see METHOD 2 https://www.thecustom droid.com/install-magisk-root-android-devices/
however 99% fellows here uses twrp! its easy and popular!
Click to expand...
Click to collapse
thanks.did the twrp method and everything worked out fine

Categories

Resources