Guide for Compiling a kernel for the Tubuntu app by x3maniac and TF101
Guide for Compiling a kernel for use with the Tubuntu application by x3maniac and TF101.
These insturctions work with 64bit Linux laptop/PC's, version 4.5.4 for the armhf toolchain, and 2.6.36 kernel version. The toolchain and kernel from the github below is the direct source x3maniac makes the kernels we are currently using. Please understand a few things, if you add modules to this build you will need to add them to your Linux image you are using. I'll provide specifics as I work through the learning process as well. If you change compilers or upgrade the software components outside of this guide it may produce errors or problems.
If you are looking for making a version 3 kernel, hardware acceleration with nvidia and things like that you will either have to ask x3maniac or do your own research as this guide does NOT tell you how to do this.
******My directories reference my own username on my laptop, please substitute "thomas" with your username OR your /home directory, or whichever directories you wish to use. I used full paths on purpose for my own learning and to be specific for newcomers to Linux who wish to learn to compile.******
All credit goes to the time and consideration x3maniac took to assist me with doing this!
OP for Tubutnu by x3maniac
1. Open Terminal. Everything will be executed from Terminal.
2. Now type: sudo apt-get abootimg
3. Now type: mkdir /home/thomas/kernelbuild
3a. Now type: cd /home/thomas/kernelbuild
4. Now type: git clone https://github.com/novaspirit/tf101-linux-2.6.36
5. Now type: git clone https://github.com/novaspirit/Ubuntu_initrd-3.x.git
6. Now type: git clone https://github.com/novaspirit/config.git
6a. The config.git has a file called /config/boot.cfg, you could modify the last line called the command line and have it boot from alternate locations, the default is fine and set to /dev/mmcblk0p8. So let's not touch it, you can use nano to edit this file.
7. Now type: git clone https://github.com/novaspirit/androi...hain-4.5.4.git
8. Now type: cd /home/thomas/kernelbuild/tf101-linux-2.6.36
9. Copy this into Terminal and hit enter: sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
10. Copy this into Terminal and hit enter: sudo apt-get install libgtk2.0-dev libglib2.0-dev libglade2-dev (this allows you to make a GUI of the config file)
11. Now type: make help (you should see a list of build targets. You are looking to see if you have tf101_gnulinux_defconf.)
12. Now type: export ARCH=arm
13. Now type: export CROSS_COMPILE=/home/thomas/kernelbuild/android-toolchain-4.5.4/bin/arm-eabi- (understand the arm-eabi- simply ends with the hypen to include sub components, it's not a typo)
14. Now type: make tf101_gnulinux_defconfig
15. Now type: make gconfig (the GUI pops up and this is where you can select options). Click on split, the options will be on the left. This is where you can select what you wish to add. For example, web cam and GPS functions. HOWEVER, it does not mean this will work nor is it all perfectly set up. There may be some additional research by YOU the reader to find out what will or won't work with this kernel. (NOTE: you must run make gconfig even if you don't change anything otherwise an error will occur when you run make -j2 modules command).
16. If you have made changes it will ask you to save. Go ahead and save it.
17. Now type: make -j2 zImage (j2 represents jobs that can be run concurrently, determined by the kernel build. This option only works if you have 2 cores and also you can use -j4 if you have a 4 core system and so on.)
18. Now type: make -j2 modules (If the github provided by x3maniac doesn't have a module you need, this is where YOU the reader must research what you need to add and place it in the appropriate location).
19. Now type: make modules_install INSTALL_MOD_PATH=/home/thomas/kernelbuild/Ubuntu_initrd-3.x/
20. Now type: cd /home/thomas/kernelbuild/Ubuntu_initrd-3.x/
21. Now type: find .|cpio -H newc -o | gzip -9 > /home/thomas/kernelbuild/initramfs.img
21b. The output should say something similar to 1111 blocks or 14582 blocks, doesn't matter the number. The number and blocks means it has been made successfully.
22. cd /home/thomas/kernelbuild
23. Now type: abootimg --create kernel.img -f /home/thomas/kernelbuild/config/boot.cfg -r initramfs.img -k /home/thomas/kernelbuild/tf101-linux-2.6.36/arch/arm/boot/zImage
23b. abootimg is very strict and will produce an error here if anything is wrong. You are looking for the output of some files created and you should see a kernel.img file in your directory with an ls command.
24. If you are going to flash the kernel using the Tubuntu application, rename kernel.img to linux.img and flash appropriately from the app.
25. If you are going to create another kernel you need to clean it up before repeating steps 12-24. So proceed to step 26.
26. Now type: cd /home/thomas/kernelbuild/tf101-linux-2.6.36
27. Now type: make clean
28. Now type: make mrproper
29. Delete kernel.img from /home/thomas/kernelbuild/
30. If you aren't modifying additional modules and parameters you can save the created initramfs.img file. Otherwise delete it and run through the steps, doesn't take long to do anyways.