Tuesday, February 11, 2014

How to Edit Android Kernels in Ubuntu



1. Select 'Accessories' from the main menu and click on 'Terminal' to open the application. The Terminal is similar to the Windows Command Prompt.

2. Type the following in the Terminal and press 'Enter' to install Java:sudo apt-get install sun-java5-jdkUse the password you use to log in to Ubuntu when you are asked for a password. This gives the application root privileges.

3. Run the following commands in the Terminal to install the rest of the tools required to edit Android kernels:sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind

4. Create the required folder structure, get a copy of the Android repository script, and give full read and write access to the script by running these commands in the Terminal:cd /home/*your-user-name

mkdir myandroid

mkdir bin

curl http://android.git.kernel.org/repo > ~/bin/repo

chmod a+x ~/bin/repo

5. Go to the 'myandroid' folder and download the Google tools and Android source, using the repository script you've downloaded earlier. Do this by running these commands in the Terminal:cd ~/myandroid

~/bin/repo init -u git://android.git.kernel.org/platform/manifest.git

~/bin/repo sync

6. Copy and paste the following command in the Terminal and press 'Enter' to run it:echo '-----BEGIN PGP PUBLIC KEY BLOCK-----

Version: GnuPG v1.4.2.2 (GNU/Linux)mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV

lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7

8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMD

u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0Z

wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq

/HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5

jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR4

MGSa1gA8s4iQbs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UOAJ9qmR0l

EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM=

=Wi5D

-----END PGP PUBLIC KEY BLOCK-----'> /tmp/android.gpg

7. Run the following commands in the Terminal to copy the key from the temporary file to the keyring and delete the temporary file:gpg --import

rm -rf /tmp/android.gpg

8. Open the Web browser and navigate to HTCDev's Kernel Source Code page (see Resources). Click on the 'Download' button next to the 'HTC EVO Shift 4G (Sprint WWE) - MVNOCRC - 2.6.32 kernel source code' entry. Save the file on your desktop.

9. Run this command in the Terminal to create a new directory:mkdir ~/.EVO_Kernel_sources

10. Open Nautilus. Nautilus is similar to Windows Explorer. The Home Folder is displayed. Press 'Ctrl' and 'H' at the same time to see hidden folders. Click on the 'EVO_Kernel_sources' folder you created earlier to open it.

11. Double-click on the source file you downloaded earlier to open the TAR archive. It contains a single folder; drag this folder from the archive to the 'EVO_Kernel_sources' folder to extract it there.

12. Run these commands in the Terminal to create the folder structure for the Android build and create a link to the kernel source you just extracted:cd ~

mkdir android

cd android

mkdir sources

cd sources

ln -s /home/*your_user_name*/.EVO_Kernel_sources/*Extracted_folder_name kernelReplace 'your_user_name' with your real Ubuntu username and 'Extracted_folder_name' with the name of the folder you extracted from the EVO Android source archive.

13. Connect the Android phone to your Ubuntu machine in data transfer mode using the USB cable. Run these commands in the Terminal to copy the Android main configuration file from the phone to the '/android/sources/kernel' folder:adb pull /proc/config.gz ~/android/sources/kernel/

cd ~/android/sources/kernel/

gunzip config.gz

14. Run these commands to edit the makefile of the Android Kernel and specify the tool-chain and compiler:cd ~/android/sources

make clean

export ARCH=arm

export CROSS_COMPILE=arm-eabi-

export PATH=$PATH:~/myandroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin

15. Run this command to start configuring the kernel options:make menuconfigScroll to the bottom of the resulting window, select the 'Load an Alternative Configuration File' option and press 'Enter.' Enter this path to the config file in the box that pops up:/home/*your-user-name*/android/sources/kernel/configPress 'Enter' again.

16. Select the make options from the menu to edit the Android kernel. It's best to select only the 'msm7k,' 'ondemand' and 'performance' as processor governors in the CPU Frequency scaling section. Check the 'Kernel debugging' option in the Kernel Hacking section if your build is a test build. Enable the 'Support for Host-side USB' and 'USB Gadget Support' if you want to use USB devices. You can also add support for various network functions, such as IP tunneling and network privacy options, in the Networking Support section.

17. Close the configuration window and select 'Yes' when prompted to save it. This action creates the hidden '.config' file inside the kernel directory.

18. Run these commands in the Terminal to insert the Wi-Fi module, and make and compile your custom Android kernel:make

export KERNEL_DIR=~/android/sources/kernel

cd ~/myandroid/system/wlan/ti/sta_dk_4_0_4_32/

make clean

make

No comments:

Post a Comment