This is one way that a new kernel can be created. It might not be the best way but it is how I am learning to make them.
Set up your files and folders so that you can use them. I put my kernel files in android/kernel/Adam. This makes it easy to locate and work with them.
If you use terminal to set this up then you can do:
mkdir android/kernel/adam
You can also use the file explorer if you like though it is good to become familiar with the terminal as it will be used a lot.
Now we change directory (CD) in to the newly created directory:
CD android/kernel/adam
Now you need to download the kernel source. You can get the stock Adam kernel source from git://github.com/notionink/adam-kernel.git (92MB).
The terminal command for this is:
git clone git://github.com/notionink/adam-kernel.git
You will also need a cross compiler. You can use the base cross compiler from git://android.git.kernel.org/platform/prebuilt.git (1.10GB).
git clone git://android.git.kernel.org/platform/prebuilt.git
This will take awhile as it is a large file. It will depend on your download speed.
You will need to get the default config file from your Adam. To do this we use adb:
adb pull /proc/config.gz
Now unzip the file:
gunzip config.gz
Or do an extract from the file explorer.
Now rename the file to .config
mv config .config
Now you can try to "make" the kernel by doing the following:
make -C ~/android/kernel/adam/adam-kernel/ ARCH=arm CROSS_COMPILE=~/android/kernel/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- zImage
In the terminal box you should see everything start to compile.
If you get the following error:
mkdir: cannot create directory `include/asm-arm/': File exists
make[1]: *** [include/asm-arm/mach-types.h] Error 1
This error occurs because the file has been zipped which creates real directories out of symlinks.
Then use this to get rid of it (thanks RaYmAn):
rm -rf include/asm-arm
Assuming everything worked correctly you should see this near the end of the text:
Kernel: arch/arm/boot/zImage is ready
You can now go to that folder to pick up the new zImage.
This next part is not necessarily needed to make a kerenl but it will make it easier to flash the new kernel to your Adam.
Now we need to repack the boot.img with the new kernel. To do this move the zImage to the same folder that has the boot.img in it. We will need to pull the boot.img apart. Make sure that you have the unpack-bootimg.pl as well as the mkbootimg file in the same folder. To unpack the boot.img use this command:
perl unpack-bootimg.pl boot.img
You should now have several files in your folder. If you want to make any changes to the init RC now is the time to do it. You will need to cd in to the boot.img-ramdisk folder before doing this. The command to rebuild the ramdisk is:
find . | cpio -o -H newc | gzip > ../newramdisk.cpio.gz
Now cd back to the main folder (the one with your all of your boot.img files) and build the boot.img. Use the following command:
./mkbootimg --kernel zImage --ramdisk newramdisk.cpio.gz -o boot.img
If you make no changes to the ramdisk then you can do the following:
./mkbootimg --kernel zImage --ramdisk boot.img-ramdisk.cpio.gz -o boot.img
You know have a new boot.img file that contains your new kernel. This can now be flashed to your Adam as you would normally flash an update file.
I have not gone in to adding new items to the kernel yet but I will update this tutorial as time permits.

Help













