[Barnes & Noble Nook Tablet] admiralspark:
This tutorial will instruct you on how to compile a kernel for the Nook Tablet.

Sources:

-B&N stock source instructions

-Adrynalyne's excellent tutorial for the Mecha

-Compiling kernels for the Arch Linux project

First and foremost, you MUST use a GNU/Linux (hereafter 'Linux') distribution. I don't care if your Mac has a BSD kernel or if you have Cygwin installed, you cannot do this without a full Linux distribution.

To keep this simple, I'm going to assume that you're using the latest version of Ubuntu Linux, version 11.10. I personally haven't used Ubuntu in a long time and so I'll include instructions for Arch when they vary.

Step 0: Pre-project Setup

This link is essential to the entire process, you will need ADB before anything else: [SCRIPT] [Ubuntu] ADB, AAPT, APKTool, Android SDK/NDK, and udev rules auto-installer

Step 1: Setting up a build environment

First, you will need to install the required packages:

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev g++-multilib lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline-gplv2-dev lib32z-dev libgl1-mesa-dev git

Next, you will need a Cross-Compile Toolchain, and for our purposes we will be using the CodeSourcery release recommended by B&N (though newer versions may work):

CodeSourcery Arm Cross-Compiler

Use the IA32 GNU/Linux TAR release.

Step 2: Pulling the Kernel Source

Now, we get to pull the kernel down and prepare it for compiling.

First, create the android directory in your home folder:

mkdir ~/android
cd ~/android

Then, we pull down the kernel source:

git clone git://github.com/admiralspark/NT-sparkkernel.git

This may take awhile if you're not on a fast connection, so go make lunch :)

While it's pulling the repo, untar the CodeSourcery cross-compiling tools into the ~/android directory. This will create a folder inside called arm-2010q1.

Step 3: Build the Kernel

Finally, what you've been waiting for!

We have to export a few things first, to prepare the build environment. Open a terminal and type:

export BOARD_KERNEL_CMDLINE="androidboot.console=ttyO0 console=ttyO0,115200n8 mem=448M@0x80000000 mem=35M@0x9CC00000 mem=512M@0xA0000000 init=/init rootwait vram=32M,9CC00000 omapfb.vram=0:5M@9CC00000"
export ARCH=arm
export CROSS_COMPILE=~/android/arm-2010q1/bin/arm-none-linux-gnueabi-

Then, we build it:

make android_4430BN_defconfig
make -jX

Where X is the total number of cpu's +1 (so, on my i7, I have 4 real + 4 virtual cores +1 = 9, so make -j9).

Optionally, running

make menuconfig

before make -jX will allow you to modify the kernel.

Now, watch the output at the end carefully an you'll see the necessary files that we need:

Building modules, stage 2.
MODPOST 1 modules
CC drivers/media/video/omapgfx/gfx_vout_mod.mod.o
Kernel: arch/arm/boot/Image is ready
AS arch/arm/boot/compressed/head.o
GZIP arch/arm/boot/compressed/piggy.gzip
CC arch/arm/boot/compressed/misc.o
SHIPPED arch/arm/boot/compressed/lib1funcs.S
CC arch/arm/boot/compressed/decompress.o
AS arch/arm/boot/compressed/lib1funcs.o
LD [M] drivers/media/video/omapgfx/gfx_vout_mod.ko
AS arch/arm/boot/compressed/piggy.gzip.o
LD arch/arm/boot/compressed/vmlinux
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready

Anything marked with an [M] will need to be remembered, as well as the location of the compiled kernel at /arch/arm/boot/zImage.

And there you go! You've successfully compiled a kernel for the Nook Tablet!

See the next post for instructions on how to actually install and USE the new kernel :)