[Transformer TF300T Q&A, Help & Troubleshooting] gaze57:
Seems I finally managed to build and flash my own JB kernel for the TF300T ! :good:

This will just be a quick and dirty wrap-up of what I did as my spare time is somewhat limited.

Hope to be able to make it more structured and with proper credits in the near future.

Anyone feel free to compile a better structured how-to with correct references and credits.

Quick credits/thanks:

seanzscreams

untermensch

Stuff needed:

- Asus kernel source (10_4_2_9_kernel.zip)

- Android NDK R8B (I'm using Linux version, android-ndk-r8b-linux-x86.tar.bz2)

- Asu-JellyBean-HYDROKernel.zip (to get a proper update package structure with update binary/script and META-INF directory)

- signing-tools.zip, BlobTools and re/unpack-bootimg.pl (can't remember where I found these :( will have to update post later...)

Preparations:

- Unpack kernel source, e.g. to $HOME/TF300/stock_kernel

- Unpack Android NDK, e.g. to $HOME/android-ndk-r8b

- Unzip Asu-JellyBean-HYDROKernel.zip, e.g. to $HOME/my_kernel

- Setup/install BlobTools and the other scripts

Step-by-step instructions:

1. Build kernel (zImage)

a) Fix minor issue in kernel source

> cd $HOME/TF300/stock_kernel

Change line 11 in file drivers/ril/ril.c

from,

#include <../../arch/arm/mach-tegra/include/mach/board-cardhu-misc.h>

to,

#include "../../arch/arm/mach-tegra/include/mach/board-cardhu-misc.h"

b) Setup build environment for cross compilation

> export PATH=$HOME/android-ndk-r8b/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin:$PATH

> export ARCH=arm

> export CROSS_COMPILE=arm-linux-androideabi-

c) Fetch /proc/config.gz from your TF300 and copy/gunzip to $HOME/TF300/stock_kernel/.config

d) Build

> make

If everything went fine you should have a new kernel under,

$HOME/TF300/stock_kernel/arch/arm/boot/zImage

2. Repack kernel

> cd $HOME/my_kernel

a) Create a 28 byte file using a hex editor for the signblob header (I named the file signblob_magic)

It should have the following contents when checked with hexdump:

> hexdump -C signblob_magic

00000000 2d 53 49 47 4e 45 44 2d 42 59 2d 53 49 47 4e 42 |-SIGNED-BY-SIGNB|

00000010 4c 4f 42 2d 00 00 00 00 00 00 00 00 |LOB-........|

0000001c

b) Unpack the boot.blob from Asu-JellyBean-HYDROKernel.zip (unzipped earlier under Preparations)

This step is just to get a proper blob directory structure and the initramfs.

> blobunpack boot.blob

> unpack-bootimg.pl boot.blob.lnx

c) Pack new kernel

Might as well post the script I made to perform this task, check comments.

#!/bin/sh

SRC_HOME=$HOME/TF300/stock_kernel

KERNEL_NAME=my_kernel

# replace kernel

cp ${SRC_HOME}/arch/arm/boot/zImage boot.blob.lnx-kernel.gz

# repack

repack-bootimg.pl boot.blob.lnx-kernel.gz boot.blob.lnx-ramdisk out.blob.lnx

blobpack out.blob LNX out.blob.lnx

# add signblob header

cat signblob_magic out.blob > boot.blob

# create zip package

zip -9 -r ${KERNEL_NAME}.zip boot.blob META-INF/

# Sign zip package using SignApk

java -Xmx1024m -jar signapk.jar -w testkey.x509.pem testkey.pk8 ${KERNEL_NAME}.zip ${KERNEL_NAME}-signed.zip

3. Flash kernel

From previous steps you should now have a signed kernel called,

my_kernel-signed.zip

Flash it using TWRP and reboot.

If flash was OK a blue status bar should appear during boot and then your TF300 will reboot again.

Confirm you have a custom kernel by checking Kernel-version under Settings once system has completed the bootup.