How To install a kernel you built yourself - Asus Transformer TF700

How do you install a kernel that you built yourself?
---------------------------------
The answer, as I understand it:
Build a kernel, with some variation of "make zImage" as the last step
Make a gzipped ramdisk image by one of the two following methods:
Use cpio and gzip (like a standard linux initial-ramdisk)
Use mkbootfs (from Android Kitchen)
Create a boot image from the gzipped ramdisk and the kernel zImage by one of the two following methods:
Use abootimg
abootimg is available for ubuntu, and is included in the ubuntu images that rabits was distributing
Use mkbootimg (from Android Kitchen)
Convert the boot image to a blob with "blobpack" (part of blobtools)
More details as I experiment with this process.

bsammon said:
Is there a guide to how to install a kernel that you built yourself?
I've seen bits and pieces of this in various threads, but no complete (or semi-complete) document on how it's done.
Click to expand...
Click to collapse
I have been searching on this topic as well. You would have a better luck searching if you use a key word like "Unpack and Repack Kernel or Ramdisk".. Good luck..

You don't know my kernel repacking guide? -> http://forum.xda-developers.com/showpost.php?p=36925180&postcount=4

_that said:
You don't know my kernel repacking guide? -> http://forum.xda-developers.com/showpost.php?p=36925180&postcount=4
Click to expand...
Click to collapse
Thanks for the head up. I will look into it... :good:

Ahh... the development forum -- that's why I didn't see it. I'll take a look at that.

_that said:
You don't know my kernel repacking guide? -> http://forum.xda-developers.com/showpost.php?p=36925180&postcount=4
Click to expand...
Click to collapse
Where do I get the "mkbootfs" and "mkbootimg" tools mentioned in that guide?

bsammon said:
Where do I get the "mkbootfs" and "mkbootimg" tools mentioned in that guide?
Click to expand...
Click to collapse
I think they are part of the Android source. Standalone sources are available in dsixda's Android Kitchen, which is what I use.

_that said:
I think they are part of the Android source. Standalone sources are available in dsixda's Android Kitchen, which is what I use.
Click to expand...
Click to collapse
I think you mean this Android Kitchen. It appears that Asus devices aren't supported by Android Kitchen, but it's your experience that it works anyway?

bsammon said:
I think you mean this Android Kitchen. It appears that Asus devices aren't supported by Android Kitchen, but it's your experience that it works anyway?
Click to expand...
Click to collapse
Nah the tools mkbootfs and mkbootimg from dsixda's android kitchen work fine.

bsammon said:
I think you mean this Android Kitchen. It appears that Asus devices aren't supported by Android Kitchen, but it's your experience that it works anyway?
Click to expand...
Click to collapse
Yes, that one. I've never used the menu-driven stuff, but you can learn a lot from reading its scripts - and many of the tools included in the kitchen work fine for all Android devices.

Related

[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......

[Q] [GT-P3100][Kernel] Compiled kernel does not boot!

Hi,
I'm trying to boot my galaxy tab2 7 with compiled kernel.
First, I downloaded kernel source from http://opensource.samsung.com.
I download GT-P3100_JB_Opensource_Update2.zip file and extract it.
To compile, I followed ketut.kumajaya's thread (http://forum.xda-developers.com/show....php?t=2086996)
I build only kernel, not other modules. Compile was done without problem.
And I extract boot.img from Stock ROM file downloaded from samsung-updates.com (http://samsung-updates.com/device/?id=GT-P3100).
Stock ROM version is P3100XXCLJ3 (that's my device's baseband version).
I unpacked boot.img and I got boot.img-kernel.gz and boot.img-ramdisk.cpio.gz.
(To make sure unpack/repack tool is working properly, I simply unpack stock boot.img and repack it. And the new boot.img was working properly. So I assume my unpack/repack tool have no problem).
So, I replace boot.img-kernel.gz with zImage and repack it.
But this time new boot image does not working (Device stuck in boot logo)
What did I done wrong? Any body help! I've been stuck with this for a week now...
(When stock ROM is flashed, Kernel version in device info is "3.0.31-595683"
You must compile pvrsrvkm kernel module as I mentioned in http://forum.xda-developers.com/showthread.php?t=1859227 and then you can use KK-Boot 0.5.x core as your flashable zip template (have PowerVR 3D driver binary inside). If you decide to keep the stock PowerVR binary, change:
#define PVRVERSION_BUILD 2166536
Click to expand...
Click to collapse
to
#define PVRVERSION_BUILD 2120756
Click to expand...
Click to collapse
and
#define PVRVERSION_BUILD_HI 216
#define PVRVERSION_BUILD_LO 6536
Click to expand...
Click to collapse
to
#define PVRVERSION_BUILD_HI 212
#define PVRVERSION_BUILD_LO 0756
Click to expand...
Click to collapse
in pvrversion.h
Do not forget to copy pvrsrvkm_sgx540_120.ko to /system/lib/modules (backup the stock modules first!)
For trouble free development, I recommend you to use GT-P3110_JB_Opensource.zip, apply all my kernel patch and use my android_espresso_omap4430_r04_blackhawk_defconfig as your kernel config file. Good luck!
necesriverua
ketut.kumajaya said:
You must compile pvrsrvkm kernel module as I mentioned in http://forum.xda-developers.com/showthread.php?t=1859227 and then you can use KK-Boot 0.5.x core as your flashable zip template (have PowerVR 3D driver binary inside). If you decide to keep the stock PowerVR binary, change:
to
and
to
in pvrversion.h
Do not forget to copy pvrsrvkm_sgx540_120.ko to /system/lib/modules (backup the stock modules first!)
For trouble free development, I recommend you to use GT-P3110_JB_Opensource.zip, apply all my kernel patch and use my android_espresso_omap4430_r04_blackhawk_defconfig as your kernel config file. Good luck!
Click to expand...
Click to collapse
Many thanx.
I really appreiciate it.
I will try this right away.
ketut.kumajaya said:
You must compile pvrsrvkm kernel module as I mentioned in http://forum.xda-developers.com/showthread.php?t=1859227 and then you can use KK-Boot 0.5.x core as your flashable zip template (have PowerVR 3D driver binary inside). If you decide to keep the stock PowerVR binary, change:
to
and
to
in pvrversion.h
Do not forget to copy pvrsrvkm_sgx540_120.ko to /system/lib/modules (backup the stock modules first!)
For trouble free development, I recommend you to use GT-P3110_JB_Opensource.zip, apply all my kernel patch and use my android_espresso_omap4430_r04_blackhawk_defconfig as your kernel config file. Good luck!
Click to expand...
Click to collapse
Dear ketut,
Because I'm behind firewall, I cannot download pvrsrvkm kernel source.
Frankly, I have very little knowledge about android system. so I'm not sure I understand your guide correctly..
What I've done is as follows:
1. Download GT-P3110_JB_Opensource
2. Apply your patch from http://forum.xda-developers.com/showthread.php?t=1859227
3. Modify PVRVERSION_BUILD and PVRVERSION_BUILD_HI and PVRVERSION_BUILD_LOW in drivers/gpu/pvr/pvrversion.h (kernel source)
4. Apply android_espresso_omap4430_r04_blackhawk_defconfig and Build (using arm-2010q1-202..)
5. Repack zImage with ramdisk.cpio.gz (extracted from stock rom file)
6. Replace boot.img in your kkboot-0.5.2-core-p31xx.zip with repacked boot.img
7. Apply new kkboot.zip in CWM and installation failed and aborted.
Am I totally in wrong direction? What am I missing here?
I sincerely ask your help.
(I found that when build kernel after your patch, additional module files (.ko) are generated.
Should I do something with that?)
cks1119 said:
Dear ketut,
Because I'm behind firewall, I cannot download pvrsrvkm kernel source.
Frankly, I have very little knowledge about android system. so I'm not sure I understand your guide correctly..
What I've done is as follows:
1. Download GT-P3110_JB_Opensource
Click to expand...
Click to collapse
Correct.
2. Apply your patch from http://forum.xda-developers.com/showthread.php?t=1859227
Click to expand...
Click to collapse
Correct, all my patch from 01-07.
3. Modify PVRVERSION_BUILD and PVRVERSION_BUILD_HI and PVRVERSION_BUILD_LOW in drivers/gpu/pvr/pvrversion.h (kernel source)
Click to expand...
Click to collapse
Incorrect, nothing to do with pvr driver inside the kernel source, it's useless. You can download eurasia_km.tgz from http://www.mediafire.com/?m9te7t4rosp131d . Do not modify PVRVERSION if you plan to use my kkboot boot image.
4. Apply android_espresso_omap4430_r04_blackhawk_defconfig and Build (using arm-2010q1-202..)
Click to expand...
Click to collapse
Code:
export CROSS_COMPILE='/opt/toolchains/arm-2010q1/bin/arm-none-linux-gnueabi-'
export LDFLAGS=''
export CFLAGS=''
export SUBARCH=arm
export ARCH=arm
make mrproper
make android_espresso_omap4430_r04_blackhawk_defconfig
make -j4
5. Repack zImage with ramdisk.cpio.gz (extracted from stock rom file)
Click to expand...
Click to collapse
Incorrect, use kkboot ramdisk for now.
6. Replace boot.img in your kkboot-0.5.2-core-p31xx.zip with repacked boot.img
Click to expand...
Click to collapse
Correct.
7. Apply new kkboot.zip in CWM and installation failed and aborted.
Click to expand...
Click to collapse
Try to unpack and repack kkboot without modification, is it works?
Am I totally in wrong direction? What am I missing here?
I sincerely ask your help.
(I found that when build kernel after your patch, additional module files (.ko) are generated.
Should I do something with that?)
Click to expand...
Click to collapse
Unpack kkboot, you will see a lot of modules inside system/lib/modules
Try to unpack and repack kkboot without modification, is it works?
Click to expand...
Click to collapse
No, unpack tool that I have is not working.
I found the tool that you've uploaded, but the unzip password was not correct for some reason
I downloaded your tool in http://forum.xda-developers.com/showthread.php?t=1241005
But while unpacking, it says below:
Code:
BOARD_KERNEL_CMDLINE console=ttyO2,115200n8 mem=1024M androidboot.console=ttyO2 vram=20M omapfb.vram=0:16M
BOARD_KERNEL_BASE 80000000
BOARD_PAGE_SIZE 00000800
gzip: ../kkboot.img-ramdisk.gz: not in gzip format
cpio: premature end of archive
Is it require special tools to unpack kkboot image?
Forgot to mention, my ramdisk packed in lzo format You need lzop application to unpack it.
ketut.kumajaya said:
Forgot to mention, my ramdisk packed in lzo format You need lzop application to unpack it.
Click to expand...
Click to collapse
You mean only ramdisk?
If so, as my understanding, unpacking boot.img in kkboot-0.5.2 and repack without any change, should be working
whether your ramdisk is packed with lzo or not.
But when I did it, I still got installation fail.
(I used the unpackbootimg in blackhawk tool from http://forum.xda-developers.com/showthread.php?t=1241005)
By the way,
I've searching about lzop compressed ramdisk and found this: https://github.com/trevd/aos-tools/blob/master/scripts/unpack-ramdisk.sh
And with this method, I could unpack ramdisk file.
Code:
cat boot.img-ramdisk.gz | lzop -d | cpio -i
But, I think this is not the point.
ketut.kumajaya said:
Forgot to mention, my ramdisk packed in lzo format You need lzop application to unpack it.
Click to expand...
Click to collapse
I simply unpack and repack boot.img from kkboot-0.5.2-core-p31xx.zip
with boot.img-tools in http://forum.xda-developers.com/showthread.php?t=1241005
Then change original boot.img with repacked one and make new zip file in external SD card.
When I go to CWM recovery and try to install new zip file, then I got following message:
Code:
-Extracting files
set_perm : some changes failed
E:Error in /external_sd/newfile.zip
(Status 7)
Installation aborted
I've been trying other tools that I could find but still does not working :crying:
ketut.kumajaya said:
Forgot to mention, my ramdisk packed in lzo format You need lzop application to unpack it.
Click to expand...
Click to collapse
Finally done it!
I've got tab 2 running my own kernel!
Again, thank you for your help and all works you've done!:good:
cks1119 said:
Finally done it!
I've got tab 2 running my own kernel!
Again, thank you for your help and all works you've done!:good:
Click to expand...
Click to collapse
Congrat :good:

Is there a Stock Kernel with Safetynet Patch?

I'm looking for a stock kernel that only patches Safetynet checking. Does this exist? If not, is it easy for me to "make it" myself?
I'm not sure if there's a prebuilt one, but building one yourself isn't too hard. The patch is at https://github.com/sultanxda/androi...bc05b16bbd33521c2fffaf491c5657a94bfcfc5.patch. You just follow the steps at http://source.android.com/source/building-kernels.html as usual with the following notes:
Use "kernel/msm" as the source location
Use "marlin_defconfig" as the build configuration
Apply the patch after running the git checkout command
Use the aarch64 prebuilts, not the arm ones
Cares said:
I'm looking for a stock kernel that only patches Safetynet checking. Does this exist? If not, is it easy for me to "make it" myself?
Click to expand...
Click to collapse
Depending on your motivation for a "stock kernel" you might try franco kernel. He doesn't seem to do anything that MIGHT introduce instability or strays very far from stock.
I can vouch for franco. He does minimal performance-only tweaks by default.
josephcsible said:
I'm not sure if there's a prebuilt one, but building one yourself isn't too hard. The patch is at https://github.com/sultanxda/androi...bc05b16bbd33521c2fffaf491c5657a94bfcfc5.patch. You just follow the steps at http://source.android.com/source/building-kernels.html as usual with the following notes:
Use "kernel/msm" as the source location
Use "marlin_defconfig" as the build configuration
Apply the patch after running the git checkout command
Use the aarch64 prebuilts, not the arm ones
Click to expand...
Click to collapse
Hey thanks for the tip. I went ahead and patched the no safetynet patch to the android-msm-marlin-3.18-nougat-mr1 kernel source and compiled it. I now have a Image.gz-dtb file which I zipped (I also just have a binary file named "Image"). What should I with those now, just flash those like I would one of the other kernels? And which file exactly? The gz file? or the just binary file named "Image"?
So essentially "fastboot flash kernel <file_name>"?
When I was compiling I got two warnings by the way:
drivers/soc/qcom/Kconfig:371:warning choice value used outside its choice group
drivers/soc/qcom/Kconfig:376:warning choice value used outside its choice group
Anything I should be concerned about? I've never done this before, but did a lot of reading before I went ahead and used to do some C coding back in the day, so it's not completely unknown to me.
Essentially, these are the steps I followed, after quickly installing Linux Mint:
Code:
Create a working directory in /home/$USER/ (I created /home/sakete/android)
Enter working directory
Download android kernal source
git clone https://android.googlesource.com/kernel/msm
Download prebuilt toolchain
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9
cd aarch64-linux-android-4.9
export PATH=$(pwd)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9
export CROSS_COMPILE=$(pwd)/bin/aarch64-linux-android-
export ARCH=arm64
export SUBARCH=arm64
Checkout specific kernel branch for Pixel/PixelXL (be in 'msm' folder)
git checkout android-msm-marlin-3.18-nougat-mr1
Get Safetynet Patch (still be in 'msm' folder)
git fetch https://github.com/sultanxda/android_kernel_oneplus_msm8996 cm-13.0-sultan
git cherry-pick abc05b16bbd33521c2fffaf491c5657a94bfcfc5
Build kernel (still be in 'msm' folder)
make clean
make mrproper
make marlin_defconfig
make -j$(grep -c ^processor /proc/cpuinfo)
I initially got some build errors, but running this command solved it: sudo apt-get install build-essential
This is a useful link for those of you who are interested in doing this as well: http://forum.xda-developers.com/showpost.php?p=69627576&postcount=7108
Hey if you can build it and post it here, that would be awesome. This is exactly what I'm looking for.
It will let me preemptively unlock my Verizon bootloader before flashing the latest OTA, while keeping Android Pay.
Has Google already posted the source for the 7.1.1 update kernel?
The source I pulled (android-msm-marlin-3.18-nougat-mr1) should be what's in the December update. It should be 7.1.1
Sakete said:
Hey thanks for the tip. I went ahead and patched the no safetynet patch to the android-msm-marlin-3.18-nougat-mr1 kernel source and compiled it. I now have a Image.gz-dtb file which I zipped (I also just have a binary file named "Image"). What should I with those now, just flash those like I would one of the other kernels? And which file exactly? The gz file? or the just binary file named "Image"?
Click to expand...
Click to collapse
The Image.gz-dtb file is the one you want.
Sakete said:
So essentially "fastboot flash kernel <file_name>"?
Click to expand...
Click to collapse
I've never done it like that, but that's apparently how Franco's kernel installs, so it's worth a shot I guess. Another way of doing it is to unpack the stock boot image with either pbatard's unmkbootimg or osm0sis's Android Image Kitchen, replace its kernel with your Image.gz-dtb, then repack and flash the new boot.img to the boot partitions.
Sakete said:
When I was compiling I got two warnings by the way:
drivers/soc/qcom/Kconfig:371:warning choice value used outside its choice group
drivers/soc/qcom/Kconfig:376:warning choice value used outside its choice group
Anything I should be concerned about? I've never done this before, but did a lot of reading before I went ahead and used to do some C coding back in the day, so it's not completely unknown to me.
Click to expand...
Click to collapse
Nothing you need to worry about.
josephcsible said:
The Image.gz-dtb file is the one you want.
I've never done it like that, but that's apparently how Franco's kernel installs, so it's worth a shot I guess. Another way of doing it is to unpack the stock boot image with either pbatard's unmkbootimg or osm0sis's Android Image Kitchen, replace its kernel with your Image.gz-dtb, then repack and flash the new boot.img to the boot partitions.
Nothing you need to worry about.
Click to expand...
Click to collapse
Great, thanks, I'll try flashing the kernel tomorrow night and will post it if successful.
Interestingly it seems that Pixel (sailfish) and Pixel XL (marlin) use the same kernel / kernel source? There at least doesn't seem to be a sailfish specific source. Will be interesting to see how it pans out tomorrow.
Sakete said:
Interestingly it seems that Pixel (sailfish) and Pixel XL (marlin) use the same kernel / kernel source? There at least doesn't seem to be a sailfish specific source. Will be interesting to see how it pans out tomorrow.
Click to expand...
Click to collapse
Indeed. The same kernel binary can run on both devices. (The ElementalX and Franco kernels don't even have separate builds for the two.)
Would you mind posting the image you built?
iPwn_ said:
Would you mind posting the image you built?
Click to expand...
Click to collapse
I'm at work now, will post it tonight.
Sent from my Pixel using Tapatalk
Stock Kernel + SafetyNet Patch applied
Well holy crap, it actually worked! Just flashed the kernel, set up android pay no problem! And everything else works just fine too.
Attached is a zip.
Steps to install (make sure you have adb and fastboot set up):
- Download file and unzip
- Reboot into bootloader (power down, hold Power + Volume Down)
- Attach device to computer
- Enter command: fastboot flash kernel <kernel_image>
- Enter command: fastboot reboot
- Disconnect device and wait for it to finish booting. That's it!
You're my hero.
Might be a lot to ask, but it would be dope if you maintained where you update the build every month for Google's latest release.
iPwn_ said:
You're my hero.
Might be a lot to ask, but it would be dope if you maintained where you update the build every month for Google's latest release.
Click to expand...
Click to collapse
I'm creating a thread in the dev section.
Edit: thread is up.
Cares said:
I'm looking for a stock kernel that only patches Safetynet checking. Does this exist? If not, is it easy for me to "make it" myself?
Click to expand...
Click to collapse
A bit late, but just for the record, ElementalX is just like stock with added features. If you don't use those features, you are essentially using the stock kernel.
I am thinking about going this route.. but I am not sure the process to flash a custom kernel on my Pixel.. would anyone be able to walk me through it? thanks!

[8/3/2019]Updated Android IMG Tools[Upto Android 9.0]

Since These tools are outdated there has been little movement with the tools since, @rkhat has made a source available to be built for linux, however im unable to get a compile.
So i decided to gather sources and make some modifications to get them compiling in cygwin and works upto android 8.1
Install cygwin in the default directory with the following packages.
libpcre1, zlib-devel, cmake, make, automake, gcc-core, gcc-g++, libgcc1, libstdc++6, cpio, flex, bison, cygwin32-gcc-core, patch, libintl
Source code
Prebuilt binaries
To build simply download and extract the source, open CMD and
Code:
path=%path%C:\cygwin64\bin;
cd to each directory and execture
Code:
make
To build e2fsprogs
Open cygwin
cd to the directory
Code:
mkdir build
cd build
../configure
make
Original Sources
Sparse utillities based on sources https://github.com/anestisb/android-simg2img
mkbootimg based on sources https://github.com/osm0sis/mkbootimg
mkbootfs based on sources https://github.com/osm0sis/mkbootfs
make_ext4fs based on sources https://github.com/jamflux/make_ext4fs
sefcontext_decompile based on sources https://github.com/wuxianlin/sefcontext_decompile
dtc based on sources https://github.com/dgibson/dtc
e2fsprogs based on sources https://github.com/tytso/e2fsprogs
Generates -
append2simg.exe
cpio.exe
dtc.exe
gzip.exe
img2simg.exe
make_ext4fs.exe
mkbootfs.exe
mkbootimg.exe
sefcontext_decompile.exe
simg2img.exe
simg2simg.exe
unpackbootimg.exe
mke2fs.exe
Contributors
SuperR, anestisb, rkhat2, osm0sis, jamflux, wuxianlin, Xannytech, CarmineRovito
Doing God's work I see.
Repo was on private, fixed it now
https://github.com/anpaza/make_ext4fs
I1V1A1N said:
https://github.com/anpaza/make_ext4fs
Click to expand...
Click to collapse
Thats a newer build, i may use it, thanks
Repository has been updated for partial 9.0 support
dose it support pie use make_ext4fs?
Nightmare_MYS said:
dose it support pie use make_ext4fs?
Click to expand...
Click to collapse
Unpacking yes but repacking not at the moment, i havent had time to look into mk2efs and the new e2fsdroid source code, the source for these are in the e2fsprogs repository, mk2efs already has a windows port in cygwin and the e2fsdroid sourcw code is in the contrib/android directory, i have built mk2efs correctly but i havent attempted e2fsdroid yet because i have been busy, maybe @osm0sis may be able to give it a shot
Ricky Divjakovski said:
Unpacking yes but repacking not at the moment, i havent had time to look into mk2efs and the new e2fsdroid source code, the source for these are in the e2fsprogs repository, mk2efs already has a windows port in cygwin and the e2fsdroid sourcw code is in the contrib/android directory, i have built mk2efs correctly but i havent attempted e2fsdroid yet because i have been busy, maybe @osm0sis may be able to give it a shot
Click to expand...
Click to collapse
i have no idea,i checked a lot of method,mke2fs just can creat a new null img,i still don't know e2fsdroid's effect,i had used ClassyKitchen to repack my pie,it working,but ClassyKitchen just a single exe file,
Nightmare_MYS said:
i have no idea,i checked a lot of method,mke2fs just can creat a new null img,i still don't know e2fsdroid's effect,i had used ClassyKitchen to repack my pie,it working,but ClassyKitchen just a single exe file,
Click to expand...
Click to collapse
thats quite odd, from looking into classy kitchen it seems that it does use make_ext4fs?
however i dont know how he has got it working, he tries hiding the functionallity of his tools quite abit, im guessing this is because of licensing issues preventing him to sell whats included in the tools and to stop other people from making a free version, the binaries are unpacked to %tmp%/BIN folder when processing a firmware, check it out
Ricky Divjakovski said:
thats quite odd, from looking into classy kitchen it seems that it does use make_ext4fs?
however i dont know how he has got it working, he tries hiding the functionallity of his tools quite abit, im guessing this is because of licensing issues preventing him to sell whats included in the tools and to stop other people from making a free version, the binaries are unpacked to %tmp%/BIN folder when processing a firmware, check it out
Click to expand...
Click to collapse
the free of classy kitchen just can build new img,if i know its working space,i maybe know it in Disk C,but i can't find it and dont't know the binaries unpacked where,i tryed to use make_ext4fs to build my pie img,it is not working,i sure Classy Kithen can,
Nightmare_MYS said:
the free of classy kitchen just can build new img,if i know its working space,i maybe know it in Disk C,but i can't find it and dont't know the binaries unpacked where,i tryed to use make_ext4fs to build my pie img,it is not working,i sure Classy Kithen can,
Click to expand...
Click to collapse
the binaries are in the %tmp%\BIN folder
Anyway this can be made to support Amazon boot images?
Sent from my MotoG3 using XDA Labs
DragonFire1024 said:
Anyway this can be made to support Amazon boot images?
Sent from my MotoG3 using XDA Labs
Click to expand...
Click to collapse
Please upload the boot image and ill see if i can do this, ill also update the sources soon because i made a utillity to split the MTK header from an MTK ramdisk
Ricky Divjakovski said:
Please upload the boot image and ill see if i can do this, ill also update the sources soon because i made a utillity to split the MTK header from an MTK ramdisk
Click to expand...
Click to collapse
Awesome. Thank you. I'll upload one as soon as I get home
Sent from my MotoG3 using XDA Labs
I'm trying to use img2sing.exe and getting "cygz.dll was not found" error. Is that file supposed to be in the zip?
zxcv888 said:
I'm trying to use img2sing.exe and getting "cygz.dll was not found" error. Is that file supposed to be in the zip?
Click to expand...
Click to collapse
that will be in your cygwin bin directory, either copy it from there to the same folder as the exe or or add the cygwin bin directory to your path environment variable
Ricky Divjakovski said:
the binaries are in the %tmp%\BIN folder
Click to expand...
Click to collapse
i didn't find that,
Nightmare_MYS said:
i didn't find that,
Click to expand...
Click to collapse
you have to run the progran and repack for it to appeart, as soon as its repacked the folder gets deleted
Ricky Divjakovski said:
Please upload the boot image and ill see if i can do this, ill also update the sources soon because i made a utillity to split the MTK header from an MTK ramdisk
Click to expand...
Click to collapse
here is the boot.img from the Amazon Fire HD 10, 2017, firmware version update-kindle-40.6.0.5_user_605485120.bin. Thank you so much. Let me know if you need anything else. Just extract the .img from the zip.

Issues with finding device tree blob (.dtb) file on Moto G72 running Android 12.1

Hi everyone,
I'm currently having trouble finding the device tree blob (.dtb) file on my Motorola phone running Android 12. I've tried unpacking the boot image file using various tools, but I haven't been able to locate the .dtb file.
Here are the steps I've taken so far:
I've rooted my phone and have access to all system files.
I've unpacked the boot image using the Android Image Kitchen and other tools, but I can't seem to find the .dtb file.
I've checked the "firmware" and "by-name" folders, but I couldn't find the .dtb file there either.
I've even tried using the dtc (Device Tree Compiler) utility to convert the device tree blob to a human-readable text file, but the resulting file was empty.
I'm at a loss as to what to do next. I need the .dtb file to make some modifications to the device tree information, but I can't seem to find it anywhere.
Has anyone else experienced this issue with a Motorola phone running Android 12? Does anyone know where the .dtb file might be located, or have any suggestions for other tools or techniques I could try?
Thanks in advanced for any help or advice you can provide!
afaik separate dtbo partition
alecxs said:
afaik separate dtbo partition
Click to expand...
Click to collapse
Isn't dtbo just an overlay?
@FiniteCode post the boot image and I'll check it for DTB.
I'm really sorry but i don't get what you guys wanna say, Actually it's my first time developing rom so you see...
Renate said:
Isn't dtbo just an overlay?
@FiniteCode post the boot image and I'll check it for DTB.
Click to expand...
Click to collapse
Thank you a lot for your support!
Thank you everyone saw your answers put them to ChatGPT understood some New Concepts and Voila! Thank you a lot everyone.... Special Thanks to @alecxs.7285913 and @renate.4474482
FiniteCode said:
Thank you everyone saw your answers put them to ChatGPT understood some New Concepts and Voila! Thank you a lot everyone.... Special Thanks to @alecxs.7285913 and @renate.4474482
Click to expand...
Click to collapse
Hmmm...
That's an Android header version 4 which only has a kernel and a ramdisk.
See: https://source.android.com/docs/core/architecture/bootloader/boot-image-header#header-v4
There appears to be no DTB tacked onto the kernel.
Also weird, the ramdisk is CPIO, but they didn't even bother to gzip it.
That dtbo has three DTBs in it, preceeded by that new 128 byte header.
It appears to all be overlays. I don't know much about that.
Code:
000000 Android header
000080 Header
0000b8 / {
0000c0 [email protected] {
0000d8 target-path = "/";
0000e8 __overlay__ {
Edit: If you want the kallsysms (using my tools):
Code:
C:\>imgutil /x boot.img payload
C:\>kallsyms /b8 payload boot.sym
Renate said:
Hmmm...
That's an Android header version 4 which only has a kernel and a ramdisk.
See: https://source.android.com/docs/core/architecture/bootloader/boot-image-header#header-v4
There appears to be no DTB tacked onto the kernel.
Also weird, the ramdisk is CPIO, but they didn't even bother to gzip it.
That dtbo has three DTBs in it, preceeded by that new 128 byte header.
It appears to all be overlays. I don't know much about that.
Code:
000000 Android header
000080 Header
0000b8 / {
0000c0 [email protected] {
0000d8 target-path = "/";
0000e8 __overlay__ {
Edit: If you want the kallsysms (using my tools):
Code:
C:\>imgutil /x boot.img payload
C:\>kallsyms /b8 payload boot.sym
Click to expand...
Click to collapse
yup... i tried to open the dtbo.img i came up with one error on every software/method i tried (bad magic number)
FiniteCode said:
yup... i tried to open the dtbo.img i came up with one error on every software/method i tried (bad magic number)
Click to expand...
Click to collapse
Lop off the first 128 (0x80) bytes (of the Android non-standard header) and you'll see the signature, bigend 0xd00dfeed.
There are three concatenated DTB(O)s.
Renate said:
Lop off the first 128 (0x80) bytes (of the Android non-standard header) and you'll see the signature, bigend 0xd00dfeed.
There are three concatenated DTB(O)s.
Click to expand...
Click to collapse
Could you attach them If possible. I've been having a hard time with getting them
@FiniteCode Oh, alright.
Renate said:
@FiniteCode Oh, alright.
Click to expand...
Click to collapse
Thank you so much can't explain my happiness like seriously thank you a lot
FiniteCode said:
Thank you so much can't explain my happiness like seriously thank you a lot
Click to expand...
Click to collapse
Don't get too excited. Each of those dtbo's are only ~100k.
A real dtb is more like 300k and upwards.
Moreover, those three are all variants of each other, they are 75%+ the same.
And since they are all actually overlays we still don't know where the base dtb is.
Edit: Oh, I forgot that I had posted my dtbview.exe (in the sig).
If you do Windows it can dump dtb & dtbo (also wacky Android header).
Code:
C:\>dtbview dtbo.img > big.txt
Some new devices with header version 4 has more in the vendor_boot.img like kernel-dt so that not in the boot.img (only kernel).
But I made attempt to extract dtbo.img & dtb. Not know if help.
UPD
Okay. Again my friend @lopestom updated me on Header V4 information.
I used the correct tools on Linux and now it seems to be much better than before. Well it looks like you have a Mediatek phone.
Attached pictures "dddd".png and unziped_dtbo.zip
Thank you all for help I'll try if this works in my custom rom
FiniteCode said:
Thank you all for help I'll try if this works in my custom rom
Click to expand...
Click to collapse
Or else, the last resort might be contacting Motorola which I don't think should help out, I don't have any hopes from Motorola...
FiniteCode said:
Or else, the last resort might be contacting Motorola which I don't think should help out, I don't have any hopes from Motorola...
Click to expand...
Click to collapse
I not search in total but has very dts and dtc files.
GitHub - AbzRaider/kernel_moto_vicky: Kernel Tree for MediaTek MT6789 Based Motorola G72 ( Vicky )
Kernel Tree for MediaTek MT6789 Based Motorola G72 ( Vicky ) - GitHub - AbzRaider/kernel_moto_vicky: Kernel Tree for MediaTek MT6789 Based Motorola G72 ( Vicky )
github.com
GitHub - theh0riz0n/android_kernel_motorola_vicky: Kernel sources for Motorola G72 DS XT2255-1
Kernel sources for Motorola G72 DS XT2255-1. Contribute to theh0riz0n/android_kernel_motorola_vicky development by creating an account on GitHub.
github.com
Kernel sources for Motorola G72 DS XT2255-1
Using which tools were you guys able to extract the boot.img I'm unable to do that actually I need to extract the ramdisk and kernel please do attach if you can
AIK is the only tool I use. maybe you have separate vendor_boot partition

Categories

Resources