[Completed] zimage kernel, how to flash it correctly?? - XDA Assist

Hello all,
Well, I just start to compile a kernel source for my Homtom HT17 (I need UVC support).
I found a source code (google HT17 kernel git)
and I compile it with success (I hope) on arm architecture (if I am not wrong, actual rom didn't use aarch64 even if the mt6737M is 64 bits)
So I have a zimage and try to flash it.
So I try to use kitchen and I am able to get to things : a new zip update that I made from a boot.img/system.img from a stock rom and I try to flash it with twrp but I had an error message (something wrong with META-INF\com\google\android\update-script)
Then I try to flash only the boot.img I made with the zimage with twrp. The phone loop at boot... (I restore it with mt flash tool and the rom I had)..
So I am very frustrated, 'cause I spent a lot of time to be able to compile the kernel...
I search a lot on Internet how to deploy correctly my kernel zimage but as now I am not able to get it running!
The problem is like I am newbies in kernel build, I dont know if my process is incorrect or my kernel is incorrect.
So finally I search somebody who could give me steps to deploy correctly my zimage on my phone...
(HOMTOM HT17 MT6737 chip)
Thanks for your reading.
Emmanuel,
Aix En Provence, France

Greeting,
Thank you for using XDA-Assist, you might get more help by others expert in here Homtom HT17-MT6737
XDA-Assist-Team

Related

[CyanogenMod][Custom kernel] stuck on splashscreen

I am very new to the android parralel scene (and the android and smartphones in general) so please excuse me if I have missed obvious things.
I am trying to do a custom android kernel on a CyanogenMod stable in order to activate SCTP support on a HTC Magic (sapphire) PVT 32B (google branded).
I have followed the this tutorial : wiki.cyanogenmod.com/index.php/Building_from_source to make the kernel (2.6.29-cm42) and this tutorial wiki.cyanogenmod.com/index.php/How_to_build_a_kernel_port for the packing.
My base is update-cm-4.2.14.1-signed.zip
I have tried with my new package as a module (and also redone modules.sqf) and also in-kernel.
I have tried the full update, and I've also tried to patch the kernel on a clean Cyanogen install.
Everytime I get stuck on the spash screen (google io09 developer conference).
Thanks for having read that post!
NB: Before the manipulation I had made a nandroid backup so I can get back without problem.
I use cm-recovery-1.4.img as recovery image with fastboot, and I noticed that I can't use adb to push data on the sdcard and then install it with the recovery. In fact the commands seem to work, but behind the scene it is the old sdcard.zip that is installed. I have to use my backup, fullboot, put my test update on the sdcard, rebootfastmode recover and then install.
Ah also, I would be really happy if you could tell me how to diagnostise errors on the bootphase. I'm currently totally helpless (and that's why I am posting here ^^).
I am now trying to build a new complete cyanogenmod from source with my custom kernel and modules. I don't think it will resolve my problem but I hope it will help me in understanding the problem.
While waiting for my repo sync (that won't end before tomorrow :/) I have made a new attempt at a CyanogenMod mod.
So i recompiled my kernel
Regenerated the modules
generated the modules.dep
Remade modules.sqf using update-cm-4.2.14.1-signed.zip as a base
Inserted wlan.ko and my new boot.img (made with unpack repack) into update-cm-4.2.14.1-signed.zip
Signed with the testkeys from the tutorial
Fastboot
update
Stuck...
I zipped some file if it could be of any help
my .config, zImage, boot.img, wlan.ko and modules.sqf
Thanks for reading
After some irc chat session I discovered it would be possible that my problem come from a bad boot.img generation.
I use old unpack / repack scripts (with whose you can't use the --base parameter).
I will try to fix this now, and retest!

How to compile and boot custom kernel on linux

Hey, so I'm in a mood to compile and test kernel sources provided by Kali-. However I've used search and googled and seriously didn't find anything that would explain the whole process from downloading crosscompiler to putting it all in phone.
So is there any good tutorial for creating and booting custom kernel?
It shouldn't be important, but I'm on Ubuntu Lucid - debian lenny on other PC no windows available atm.
Any help would be appreciated.
cyanogen's wiki has some info on compiling his kernel. i'd look there first
Yeah I did, but it's different and a bit outdated. My compilation end without error ($? == 0) but still no zImage.
edit: Few make's later zImage magically appeared! I've extracted current kernel and ramdisk. The question is now - how to flash it back ? Not sure if simple cat file.img > /dev/mtd/mtd2 will work.
edit2: Compiled native desire kernel using extracted .config, created image and flashed but still no go - It's my first android so I don't know how to even debug this. I believe i got kernel panic somewhere but still don't know how to fix it - any help? This is a dev forum right?
maybe check #htc-linux on freenode irc. they might be able to help you out in compiling the kernel in general, maybe not so much in desire-specific.

[HowTo] Compile the Kernel Source Code for the HTC One XL

Hi guys!
Someone requested a tutorial on how to build the kernel source code, so I thought I might as well do it I'll give you a bit more information too.
Maybe this will kick start kernel development a little bit too. Who knows.
Anyway:
1. Set up your build environment as per this guide by AOSP here: http://source.android.com/source/initializing.html
This guide will be primarily aimed at Ubuntu, but it should be easy enough to do on other Linux PCs. Ubuntu is highly recommended. And don't ask about Windows.
2. Download the toolchains: http://code.google.com/p/rohan-kernel-evita/downloads/detail?name=toolchains.tar.gz&can=2
I've hosted both GCC 4.4 and GCC 4.6 (prebuilt) on my Google Code page. These are for Linux.
Download the toolchain package here: http://code.google.com/p/rohan-kernel-evita/downloads/detail?name=toolchains.tar.gz&can=2
Then un-tar the archive and extract it to your home folder so that the path to the toolchain directories are ~/toolchain/whatever-one-you-want
3. At this point you can decide which kernel source you want to download. There are really two sources.
The first choice is getting it from HTC Dev directly. This is good if you want to build your kernel for a Sense 4 ICS ROM. If you want to build for AOSP/JB, then scroll down below all the following HTC stuff.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
To use HTC's source:
Go to HTCdev.com and make an account. Then download the source code for our device (I'd recommend the "One X" source under carrier "AT&T" version "2.20". Let the zip file download and extract it to your home folder (so the path is /home/user/evita-ics..../
To build HTC's source, run these commands:
Code:
cd ~/evita-ics-whatever_the_directory_is_named
export ARCH=arm
make elite_defconfig
Second command is saying what type of architecture we want (we are compiling for ARM processors, so we want ARM)
Third command is saying to make the default config for our device (whose hardware is codenamed "elite")
Then to build the actual kernel:
Code:
make -j# ARCH=arm CROSS_COMPILE=~/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
In the command above, there is "-j#". Replace the "#" with the number of CPUs you have.
Ask me about it if you need help. That should be it! Let the build go and in a few minutes you should have a zImage file located at ~/evita-ics-..../arch/arm/boot. That is the actual kernel.
To test out the zImage (kernel), connect your device via fastboot mode and type:
Code:
fastboot boot /path/to/zImage
Combined with the ramdisk, thats what makes the boot.img file. Eventually if you want to distribute your kernel, you should use an installer that injects the zImage into the boot.img or combine the zImage with a ramdisk to make a boot.img. I can do a tutorial on that later on as well.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
To get the "other" source:
This source is based off of HTC's source and includes other devices as well in it (the One S and Evo 4G LTE). Its good if you want to build JB AOSP kernels.
To download this kernel source do this:
Code:
mkdir ~/kernel
cd ~/kernel
git clone https://github.com/CyanogenMod/android_kernel_htc_msm8960.git -b android-msm-evita-3.0
This version also includes a number of optimizations and odd bug fixes present in the HTC version.
To build this second source, run these commands:
Code:
cd ~/kernel/android_kernel_htc_msm8960
export ARCH=arm
make elite_defconfig
Second command is saying what type of architecture we want (we are compiling for ARM processors, so we want ARM)
Third command is saying to make the default config for our device (whose hardware is codenamed "elite")
Then to build the actual kernel:
Code:
make -j# ARCH=arm CROSS_COMPILE=~/toolchain/arm-linux-androideabi-4.6/bin/arm-eabi-
In the command above, there is "-j#". Replace the "#" with the number of CPUs you have.
Ask me about it if you need help. That should be it! Let the build go and in a few minutes you should have a zImage file located at ~/evita-ics-..../arch/arm/boot. That is the actual kernel.
To test out the zImage (kernel), connect your device via fastboot mode and type:
Code:
fastboot boot /path/to/zImage
Combined with the ramdisk, thats what makes the boot.img file. Eventually if you want to distribute your kernel, you should use an installer that injects the zImage into the boot.img or combine the zImage with a ramdisk to make a boot.img. I can do a tutorial on that later on as well.
-----------------------------------------------------------------------------
The second option is also a bit better as it uses the 4.6 toolchain instead of GCC 4.4. HTC's source doesn't work with GCC 4.6 so it can't be used without changes that the second source has.
If you have any questions, feel free to post here, message me on twitter (@rohanXm), chat me on IRC (#HTC-One-XL) or PM me!
If this helped you, please consider hitting the donation link under my username on the left. Donations are never required but always appreciated.
Instead of downloading cm10 the readme inclided with the HTC source has directions for getting a tool chain which will compile the source.
Sent from my HTC One X using Tapatalk 2
Perfect. Now I just have to read.
Sent from my HTC One XL bumping it
rohan32 said:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b jb
Click to expand...
Click to collapse
FYI, It looks like the branch name has changed. When I changed "jb" to "jellybean" the repo init command worked.
Rohan. You are one bad MF'er
Sent from my twin turbo'ed OneXL rocking rezound beats
rohan32 said:
2. You can either try to find a standalone package of the precompiled toolchain, or you are going to need to download a ROMs source. I'd recommend downloading a ROMs source since I've never found a good toolchain that worked for me. If you find one that works, post below
For now we will download CM10 since that seems like the defacto standard.
Click to expand...
Click to collapse
I downloaded the 2.20.502.7 kernel source and when I extracted it there was a file named evita_readme.txt which gave another, possibly more "official", location for downloading a toolchain:
--Please follow below command to download the official android toolchain: (arm-eabi-4.4.3)
git clone https://android.googlesource.com/platform/prebuilt
Click to expand...
Click to collapse
I just performed a build with this toolchain but got this error when I attempted to load zImage via fastboot:
c:\>fastboot flash boot zImage
sending 'boot' (5140 KB)...
OKAY [ 1.044s]
writing 'boot'...
FAILED (remote: image error! (BootMagic check fail))
finished. total time: 1.077s
Click to expand...
Click to collapse
I'm not sure if this is caused by the toolchain or if I screwed something up. Have you ever seen this error before?
EDIT: Ok I see what I did incorrectly. The zImage needs to be "Combined with the ramdisk". You wouldn't know how to perform this operation... would you?
denversc said:
I downloaded the 2.20.502.7 kernel source and when I extracted it there was a file named evita_readme.txt which gave another, possibly more "official", location for downloading a toolchain:
I just performed a build with this toolchain but got this error when I attempted to load zImage via fastboot:
I'm not sure if this is caused by the toolchain or if I screwed something up. Have you ever seen this error before?
EDIT: Ok I see what I did incorrectly. The zImage needs to be "Combined with the ramdisk". You wouldn't know how to perform this operation... would you?
Click to expand...
Click to collapse
You are trying to flash a zImage
To my knowledge, only booting zImages work on this device. For the time being just boot the zImage (use fastboot boot zImage)
I will make a tutorial on how to combine the zImage created with a ramdisk to make a boot.img when I get the chance
denversc said:
FYI, It looks like the branch name has changed. When I changed "jb" to "jellybean" the repo init command worked.
Click to expand...
Click to collapse
Oops, my bad! That was a mistake. AOKP uses -jb and CM uses -jellybean so I got them switched fixed now
Out of any device I've seen more people actually interested in helping and learning to help then any other community. I've watched noobs become less noobish.. I've watched skizz learn how to make themes. Hell I've learned 10 fold what I knew before this phone myself.
That is beautiful, and now such an informed, helpful post such as this.
Have great Sunday you guys! I think I might give this a shot!
Sent from my One X
I'll streamline this process in a bit, so that you don't need to download CM10
Edit: cleaned up post, now I'm uploading just the toolchains. Its a tar.gz archive, around 150mb. Much better than downloading the entire CM10 source
rohan32 said:
You are trying to flash a zImage. To my knowledge, only booting zImages work on this device. For the time being just boot the zImage (use fastboot boot zImage)
Click to expand...
Click to collapse
Thanks for your response, rohan. You are absolutely right: I was incorrectly attempting to flash zImage straight to the boot partition, and the error produced by flashboot was justified. I have since successfully "tested out" my compiled zImage by flashing it via "fastboot boot zImage" and it worked like a charm! I ported the modifications from sbryan's Blackout BeastMode kernel and I am now able to OC to 2106 MHz and UC to 192 MHz. It's been running solid for the past few hours at least
Of course, the kernel reverts back to the one stored in the boot partition after a reboot, and I want my shiny new kernel to "stick". I've done a bit of research on this topic and found some information about combining my zImage with a ramdisk into a "real" boot.img but have not yet been successful in creating a boot.img which does not bootloop after flashing it.
For example, I found an article on xda called Basic Kernel Kitchen for Minor Kernel Tweaking which points to a "kitchen sink" tool for creating a boot.img from a zImage and a ramdisk. My problem is that I don't know where to get or how to make a ramdisk. So I tried using the ramdisk from the boot.img of the ROM that I am currently running (CleanROM 4.5 DE) but just got into a bootloop. I've since been doing some yard work today so haven't gotten back to investigating further.
I also found another program named abootimg which can also produce a boot.img from a zImage abd a ramdisk, but when I tried it an error message about my zImage being "too big" was produced.
If it's not obvious yet, I am kind of fumbling around in the dark as compiling and deploying custom kernels is completely new to me! But this post was the most valuable resource I've come across in getting to this point. Thanks so much for writing it! I eagerly await your next article about creating the boot.img
---------- Post added at 06:05 PM ---------- Previous post was at 05:50 PM ----------
rohan32 said:
cleaned up post
Click to expand...
Click to collapse
Thanks for cleaning up the post rohan. I have a few follow-up questions/comments:
missing toolchains link -- the post says "Download the toolchains:" but there is no link to download anything... did you forget to paste the link?
official toolchain -- That's great that you uploaded the toolschains to save tonnes of bandwidth. The CM10 source was taking a VERY long time for me to grab. However, I imagine some people (like me) would prefer to get the toolchain from an "official" source. In the "evita_readme.txt" file of the kernel sources downloaded from HTC dev it instructs one to use the official sources from "git clone https://android.googlesource.com/platform/prebuilt". This is the toolchain that I used and it successfully built the zImage.
ko files -- I noticed in the ZIP file for Blackout BeastMode, in additional to installing the zImage it also puts a bunch of "ko" (kernel modules I believe) into the /system partition (eg. qce40.ko). Should I also be deploying .ko files from my build to the device?
Thanks!
denversc said:
Thanks for your response, rohan. You are absolutely right: I was incorrectly attempting to flash zImage straight to the boot partition, and the error produced by flashboot was justified. I have since successfully "tested out" my compiled zImage by flashing it via "fastboot boot zImage" and it worked like a charm! I ported the modifications from sbryan's Blackout BeastMode kernel and I am now able to OC to 2106 MHz and UC to 192 MHz. It's been running solid for the past few hours at least
Of course, the kernel reverts back to the one stored in the boot partition after a reboot, and I want my shiny new kernel to "stick". I've done a bit of research on this topic and found some information about combining my zImage with a ramdisk into a "real" boot.img but have not yet been successful in creating a boot.img which does not bootloop after flashing it.
For example, I found an article on xda called Basic Kernel Kitchen for Minor Kernel Tweaking which points to a "kitchen sink" tool for creating a boot.img from a zImage and a ramdisk. My problem is that I don't know where to get or how to make a ramdisk. So I tried using the ramdisk from the boot.img of the ROM that I am currently running (CleanROM 4.5 DE) but just got into a bootloop. I've since been doing some yard work today so haven't gotten back to investigating further.
I also found another program named abootimg which can also produce a boot.img from a zImage abd a ramdisk, but when I tried it an error message about my zImage being "too big" was produced.
If it's not obvious yet, I am kind of fumbling around in the dark as compiling and deploying custom kernels is completely new to me! But this post was the most valuable resource I've come across in getting to this point. Thanks so much for writing it! I eagerly await your next article about creating the boot.img
---------- Post added at 06:05 PM ---------- Previous post was at 05:50 PM ----------
Thanks for cleaning up the post rohan. I have a few follow-up questions/comments:
missing toolchains link -- the post says "Download the toolchains:" but there is no link to download anything... did you forget to paste the link?
official toolchain -- That's great that you uploaded the toolschains to save tonnes of bandwidth. The CM10 source was taking a VERY long time for me to grab. However, I imagine some people (like me) would prefer to get the toolchain from an "official" source. In the "evita_readme.txt" file of the kernel sources downloaded from HTC dev it instructs one to use the official sources from "git clone https://android.googlesource.com/platform/prebuilt". This is the toolchain that I used and it successfully built the zImage.
ko files -- I noticed in the ZIP file for Blackout BeastMode, in additional to installing the zImage it also puts a bunch of "ko" (kernel modules I believe) into the /system partition (eg. qce40.ko). Should I also be deploying .ko files from my build to the device?
Thanks!
Click to expand...
Click to collapse
Hey!
Sorry, set it to upload then got distracted Link posted
The reason why your boot.imgs bootloop is because there is a special ramdisk address that needs to be set when combining the ramdisk with the zImage, and most kitchens don't support this. You also need to set the address after setting the base value.
I will post a guide on how to make it a real boot.img whenever I get the chance.
I'm telling you people, Rohan is a BOSS. Most helpful dev I know.
Sent from my HTC One XL using xda app-developers app
rohan32 said:
Hey!
Sorry, set it to upload then got distracted Link posted
The reason why your boot.imgs bootloop is because there is a special ramdisk address that needs to be set when combining the ramdisk with the zImage, and most kitchens don't support this. You also need to set the address after setting the base value.
I will post a guide on how to make it a real boot.img whenever I get the chance.
Click to expand...
Click to collapse
I have the zImage thanks to your tutorial, but I want to know how to create the kernel zip, whenever you have time will be amazing if you can post a guide, I'm really looking forward to that guide, because i haven't been able to locate a guide that works
Sent from my HTC One XL using xda premium
rohan32 said:
Hi guys!
Second command is saying what type of architecture we want (we are compiling for ARM processors, so we want ARM)
Third command is saying to make the default config for our device (whose hardware is codenamed "elite")
Then to build the actual kernel:
Code:
make -j# ARCH=arm CROSS_COMPILE=~/toolchain/arm-linux-androideabi-4.6/bin/arm-eabi-
Click to expand...
Click to collapse
This is the correct make for "other source" kernel.
Code:
make -j# ARCH=arm CROSS_COMPILE=~/toolchain/arm-linux-androideabi-4.6/bin/[COLOR="Red"]arm-linux-androideabi-[/COLOR]
Can you make a tutorial on how to insert governors into a kernel?
Compiling problem
Hey man,
Please help me I followed your article but when I try copile with:
make -j2 ARCH=arm CROSS_COMPILE=~/toolchain/arm-eabi-4.4.3/bin/arm-eabi
I got something like this:
/home/martin/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/as: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
Thanks
UPDATE:
now its work
I went deeper and install lib32z1 with "sudo apt-get install lib32z1"... now its work
My device repositories are not available on github, But I got device tree and vendor blobs by making changes in similar device repo. That reference device's kernel's lineageos_defconfig is situated in htc msm8974 kernel repo. So how can I get lineageos_defconfig for my device, and which other my device related kernel files(.dtsi or any other) I have to push in htc msm8974 repo and get those files to make things ready for build?
Please help......

Compile stock kernel for SM-G950F / SM-G955F

Hello,
I am participating in the thread to try to get DeX working without the station. I have the kernel source for SM-G950F (the one I rooted is S8, my main phone, official status, is the S8+).
I used stock Ubuntu 17.04.
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9
export CROSS_COMPILE=..../aarch64-linux-android-4.9/bin/aarch64-linux-android- # Also hardcoded CROSS_COMPILE into Makefile as a futile attempt
export ANDROID_MAJOR_VERSION=7
make ARCH=arm64 exynos8895-dreamlte_eur_open_defconfig
make ARCH=arm64 -j8
It compiles, but with section mismatch. When flashed, it did not boot. Just hangs. No blue light.
I complained to Samsung. They instantly refused to have anything to do with it because of "root". I wasn't asking for support with the phone. I wanted to know why the source code does not work.
I verified that I was packing the boot.img properly after all with Windows Android Kitchen - I unpacked stock boot.img, repacked, flashed, and it worked.
The aim is to have a 100% custom kernel, but with CONFIG_DISPLAYPORT_ENG=y. And perhaps kill SE always enforcing.
But I am losing my mind right now. Nobody can help. They just say use a custom kernel. There are two things wrong with this. Custom kernels might cause other issues with Samsung DeX, and also, the developer of the custom kernel must have made the original source code compile successfully from source to make their custom kernel.
Maybe the section mismatch has nothing to do with it. But it is all I have right now. I tried other versions of toolchain, as well as UberTC or something. They all don't compile at all - they error partway through.
If anybody could show me how to take a stock boot.img and kernel source code from the SM-G950F, and repack the boot.img with the freshly compiled kernel, I would be most appreciative.
PS: My screen is completely stuffed, that is how I bought the phone so cheaply. So in TWRP, I can only see ghost images and have to guess where to tap to install the boot.img. Once it has booted, I use screen mirroring or DeX to a monitor.
Please let me know if you have any ideas. I can provide more information on request.
Did you ever resolve this?

MTK kali nethunter kernel porting problem

hey guys, im new to porting new kernels to my phone
i flashed kali nethunter on my MTK device but when i try to flash the kernel it fails when it comes to decompressing boot.img and it show this error (Unpacking boot image failed) using this command :
"$bin/bootimg" xvf boot.img "$split_img"
i tried to flash this kernel in both stock and custom rom but the same error appears
i think nethunter kernel installer isn't made for MTK devices because when i decompressed boot.img it listed files that's not present in the installer like this one (boot.img-ramdisk) it only shows compressed (kernel.gz) and (ramdisk.gz) and (cpiolist) and (bootinfo) and (initrd) folder.
i saw some going modifies boot.img to make a flashable compatible kernel of nethunter depending on given boot.img so
pleaaaaaase guys help me in this situation im really excited to test my alfa in kali nethunter :crying: :crying: :crying:
my phone:
Gionee M5 Lite
kernel version: 3.18.19
rom: lineage os 14.1
nethunter generic-arm64-kalifs-full-rolling-2017.11-18-1618
boot.img:
htt ps: // drive.goo gle. com /file/d/1FN5ogaRRboCKS2ap2_dzYpLdxenJjbse/view?usp=sharing

Categories

Resources