- 03-07-2010, 07:38 PM
Thread Author #1
- 03-07-2010, 07:38 PM
Thread Author #2
When it's done and you're back to your command prompt, copy and paste this long command, all at once. This is all one command and it contains Google's PGP key to ensure everything and anything you download from the Android GIT repo is really from Google. Don't skip this step.
This copies Googles public key to a file on your system at /tmp/. Next we need to import the key into your keyringCode: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 MGSa1gA8s4iQbsKNWPgp7M3a51JCVCu6l/8zTpA+uUGapw4tWCp4o0dpIvDPBEa9 b/aF/ygcR8mh5hgUfpF9IpXdknOsbKCvM9lSSfRciETykZc4wrRCVGhlIEFuZHJv aWQgT3BlbiBTb3VyY2UgUHJvamVjdCA8aW5pdGlhbC1jb250cmlidXRpb25AYW5k cm9pZC5jb20+iGAEExECACAFAknnWD4CGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX gAAKCRDorT+BmrEOeNr+AJ42Xy6tEW7r3KzrJxnRX8mij9z8tgCdFfQYiHpYngkI 2t09Ed+9Bm4gmEO5Ag0ESedYRBAIAKVW1JcMBWvV/0Bo9WiByJ9WJ5swMN36/vAl QN4mWRhfzDOk/Rosdb0csAO/l8Kz0gKQPOfObtyYjvI8JMC3rmi+LIvSUT9806Up hisyEmmHv6U8gUb/xHLIanXGxwhYzjgeuAXVCsv+EvoPIHbY4L/KvP5x+oCJIDbk C2b1TvVk9PryzmE4BPIQL/NtgR1oLWm/uWR9zRUFtBnE411aMAN3qnAHBBMZzKMX LWBGWE0znfRrnczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71MnrF6fj+Udtb5+ OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/M pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7s KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjA vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwo G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM= =Wi5D -----END PGP PUBLIC KEY BLOCK-----"> /tmp/android.gpg
Whats going on here -Code:gpg --import < /tmp/android.gpg rm -rf /tmp/android.gpg
- PGP (pretty good privacy) is a standard for security across many platforms. It's very common for people who offer up source code to provide a copy of their Key so you can verify that the code really came from them. As long as we know that the Public portion of the key (the long string above) actually came from Google (it does, and you can find it on the web to verify character by character if you like. I won't be offended if you don't trust me in this situation) then the code we downloaded can be verified as being signed by the person who's key is listed above. Yes it's confusing. You need to create a key to sign anything. The key is in two parts – public and private. If you check the signature against the public portion of the key (that long *** text block above) it will tell you if it was signed with the private portion of the key pair. We're taking that key and copying it to a text file so we can have Googles public portion in our keyring.
- Use that text file, import it into your keyring
- Delete the temporary text file after we import it and verify
You will see an error if anything went wrong. If that happens, stop and ask for help. This step needs done correctly, and it's much easier to fix the PGP key than it is to start over from scratch again.
This is a good stopping point for reading, and actually doing it. The rest will follow soon.
Post any questions, no matter how "stupid" you think they are. We're all here to learn by doing and sharing.Last edited by Jerry Hildenbrand; 03-08-2010 at 06:43 PM.
(•‿•)Thanked by 3: - 03-07-2010, 07:39 PM
Thread Author #3
4. Download and install kernel sources
The next step is to download the Linux kernel sources. At this point in time, we only have the 2.6.27 sources. HTC has not released a ROM using any newer sources, so they don't have to release the kernel source. The minute they (or anyone else - this means you, me and all other Developers) release a different version they are required to make the source available.
More interesting to us, , with the following fixes -
Multi-Touch/OpenGL lite
Improved memory management
You can download either of these, or both. The following instructions work for either package.
1. Download the source package of your choice, and save it to your Desktop.
2. open the terminal, and enter the following:
3. Open Nautilus. It's Ubuntu's version of Windows Explorer. You will find it under Places -> Home folder in the top bar. Make sure you're in your home folder!Code:mkdir ~/.Hero_Kernel_sources
4. While the Home Folder window is focused, hit CTRL+H . You'll be able to see hidden folders then. Find the folder you created above (.Hero_Kernel-sources) and open it by clicking on it.
5. Double click the source package you downloaded above. You'll see one folder. Drag the folder from the source package into your .Hero_Kernel_sources folder. It might take a while because the file is tarr'd and bzipped, but it will copy over. When it's finished, open the folder and look through it if you would like. The README and CHANGELOG are just the standard notes from the Linux Kernel maintainers, HTC didn't add any info.
6. Go back to your terminal, and enter the following -
What all this means -Code:cd ~ mkdir android cd android mkdir sources cd sources ln -s /home/*your-user-name*/.Hero_Kernel_sources/*EXACT NAME OF THE FOLDER YOU EXTRACTED FROM THE ZIP kernel
- make sure we're in our home directory
- Make a new folder named android
- switch to that folder we just made (android)
- Make a new folder named sources
- switch over to the new directory we just made
- Create a symbolic link to the kernel source package we downloaded and extracted, and name it kernel. Make sure there is a space between the last letter of the folder name and the word kernel at the end of this line.
Now whenever we need to enter our kernel source directory, we can just go to ~/android/sources/kernel. This makes for much cleaner and easy to type commands, and if we download new sources we can just delete the symlink and create a new one like we did in step 6 above. It's good practice to place all your local (things that aren't sync'd) files and folders that have to do with Android in your personal ~/android directory. Even though it's very unlikely that anyone else will use our machine, it's always best to try to maintain and use good coding and housekeeping practices.Last edited by Jerry Hildenbrand; 03-11-2010 at 06:48 PM.
(•‿•)Thanked by 2: - 03-07-2010, 07:40 PM
Thread Author #4
5. The Cheat Sheet
Each time you want to build your kernel source you'll need to set some variables. Even if you're ONLY using the machine to build android kernels, you don't want these active all the time.
Fire up the text editor (applications->accessories->gedit Text Editor and make yourself a little cheat sheet by copying the following into a blank file:
Save this cheat sheet anywhere you like. It's just a reference so you don't have to dig through a pile of post-it's or dig through folders. You will need these commands when we start making the kernelCode:#To make kernel export ARCH=arm export CROSS_COMPILE=arm-eabi- export PATH=$PATH:~/myandroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin #To make wifi module export KERNEL_DIR=~/android/sources/kernel cd ~/myandroid/system/wlan/ti/sta_dk_4_0_4_32/ #Pull kernel config from running phone adb pull /proc/config.gz ~/android/sources/kernel/ cd ~/android/sources/kernel/ gunzip config.gz #Pull boot image from running phone adb shell cat /dev/mtd/mtd2 > /sdcard/running.img exit adb pull /sdcard/running.img /PATH TO PLACE BOOT IMAGE cd *path-you-placed-the-image cp running.img boot.img #Locations ~/android/sources/kernel/arch/arm/boot/zImage <-----compiled kernel ~/myandroid/system/wlan/ti/sta_dk_4_0_4_32/wlan.ko <-----WiFi module
Last edited by Jerry Hildenbrand; 03-11-2010 at 06:49 PM.
(•‿•)Thanked by: - 03-07-2010, 07:40 PM
Thread Author #5
6. Building the kernel
The first thing you need is the config for the running kernel. In the above post there's a section in the cheat sheet to get this
This will leave a file named config in /home/*your-user-name*/android/sources/kernel/ . We need this to see what HTC thinks we have to have in our kernel.Code:#Pull kernel config from running phone adb pull /proc/config.gz ~/android/sources/kernel/ cd ~/android/sources/kernel/ gunzip config.gz
Lets edit the makefile
- 1. Open your terminal, and head to your kernel source code directory.
- 2. At the prompt, type
(you do NOT have to do this if you downloaded one of the packages above. i have already cleaned them. It is however a good practice to get in to.Code:make clean
- 3. Next we need to specify our tool-chain and cross compiler.
Look at your cheat sheet, we need to enter this (one line at a time)
Code:export ARCH=arm export CROSS_COMPILE=arm-eabi- export PATH=$PATH:~/myandroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin
- 4. When that's finished, enter the command
Code:make menuconfig
- 5. In the window that opens (inside your terminal) scroll to the bottom. Highlight the "Load an Alternative Configuration File" entry and hit enter. In the space that pops up, type the full path to the config file you pulled from your phone- /home/*your-user-name*/android/sources/kernel/config and hit enter.
- 6. Edit your kernel make options by selecting or deselecting them from the menu.
Here's the changes from my latest kernel -
1. General Setup--->
local version - append to kernel release
change this to something so you know which version of your kernel is running at a glance
2. System Type --->
[ ] HTC Performance Lock (uncheck)
MSM Hardware 3D Register Driver (Android 2.0+ (Eclair)) --->
(select whether this kernel will be for cupcake or eclair)
3. CPU Frequency scaling --->
(select the cpu governors you want to include. Less is better, i use msm7k, ondemand, and performance)
4. Kernel hacking --->
[ ] Kernel debugging (unchecked for release builds, checked for test builds)
That's it. That combined with the patched sources will give you a basic kernel with 3d accell, multitouch, scalable cpu frequency, and improved memory management.
Some fun things to think about in your kernel
USB host
Device Drivers --->[*] USB support --->
< > Support for Host-side USB
< > USB Gadget Support --->
Check these if you want to play with USB interface support. Things like flash drives, keyboards, etc.
File system support
File systems --->
this is where you can add support for other file systems. Don't remove any that are already checked! In a nutshell you can have ext4, resierfs, or JFS support for sd card partitions. Handy if you're going to play with apps2sd
Networking options
[*] Networking support --->
Networking options --->
this is where you can add support for IP tunneling, and other network privacy options.
Once you're done, exit out of the config. you'll be asked if you want to save your configuration. Select yes. It will save it inside the kernel source directory as .config ( a hidden file). At your prompt, type
This will build the kernel and any included modules (ip tunneling, USB gadgets, etc).Code:make
(Look at the last few lines of output to see the names and locations of any modules. We'll need them. If you haven't built anything as a module, don't worry about it)
It will not build the wifi module. We need to do that next so back to the cheat sheet.
At your prompt, one line at a time-
now you have the compiled kernel and wireless module. On our cheat sheet we see these are located:Code:export KERNEL_DIR=~/android/sources/kernel cd ~/myandroid/system/wlan/ti/sta_dk_4_0_4_32/ make clean make
Copy these into a work directory for later. you'll need them when we build the boot.img and kernel package.Code:#Locations ~/android/sources/kernel/arch/arm/boot/zImage <-----compiled kernel ~/myandroid/system/wlan/ti/sta_dk_4_0_4_32/wlan.ko <-----WiFi module
Last edited by Jerry Hildenbrand; 03-11-2010 at 06:50 PM.
(•‿•) - 03-07-2010, 07:41 PM
Thread Author #6
7. Testing the whole thing
Attached to this post is a zip file named imagetools.zip . Download it, and extract the scripts folder inside it to your android folder.
open your terminal and type the following
This file is the "settings" for your terminal. Spend a fun rainy Saturday googleing bashrc to learn all about tweaking it, but for now we're just going to edit the path.Code:gedit .bashrc
Add these two lines to the bottom of the file
Of course edit it so it has YOUR path to the tools and scripts instead of mine, and save the file. Close the terminal and reopen it.Code:export PATH=${PATH}:/home/gbhil/android/android-sdk-linux_86/tools export PATH=${PATH}:/home/gbhil/android/scripts
to see that the changes stuckCode:echo $PATH
Create a "working" folder. For our purposes, we're going to make this one -
copy the zImage from above, and the wlan.ko module to this folder. Open the zip file of your favorite ROM, and extract the boot.img file from it inside our new working folder as well. Now enter these commands VERY carefully one line at a time:Code:mkdir ~/kernel_test
Whats happening you ask?Code:cd ~/kernel_test ./extract-kernel.pl boot.img ./extract-ramdisk.pl boot.img rm boot.img-kernel cp zImage boot.img-kernel ./mkbootfs boot.img-ramdisk | gzip > ramdisk-boot ./mkbootimg --kernel boot.img-kernel --ramdisk ramdisk-boot --cmdline "no_console_suspend=1 console=null" -o myBoot.img --base 0x19200000
- move into our work folder
- use the python script we placed in our new scripts folder to extract the kernel from the boot image
- Use the Python script to extract the ramdisk
- delete the kernel that was inside the boot.img
- copy/paste our newly compiled kernel with the correct name to re-assemble the boot.img
- re-assemble the ramdisk and get it ready to place into a new boot image
- Take the re-assembled ramdisk and our new kernel and create a new boot image named myBoot.img
Now copy the myBoot.img and the wlan.ko file onto the root folder of your SD card. Reboot your phone to recovery. Preform a Nandroid backup, because this next step gets flakey sometimes. Reboot the phone normally, and plug it in to your computer. DO NOT TOUCH IT OR DO ANYTHING ELSE after you plug it in. Once the phone is booted, open your terminal and very carefully type the following:
some notes -Code:adb shell cat /dev/zero > /dev/mtd/mtd2 flash_image boot /sdcard/myBoot.img reboot
You WILL see an out of memory error at the second step. That's fine
Your phone may boot into fastboot. If it does, disconnect from the pc and restart. If it fails to restart, reboot to recovery and restore the backup you just made and try again. We aren't touching the recovery image so it should remain the same as it is now.
Once your phone boots, at the terminal once again -
When the phone reboots, check to be sure wifi can start. Even if you don't have an AP to connect to, it will show an error if somethings wrong.Code:adb remount adb shell cp /sdcard/wlan.ko /system/lib/modules/wlan.ko reboot
If the wifi loaded correctly (with no errors or did connect), you're running your own kernel. Congratulations.Last edited by Jerry Hildenbrand; 03-11-2010 at 06:50 PM.
(•‿•) - 03-07-2010, 07:57 PM #7
- 03-07-2010, 07:59 PM
Thread Author #8
(•‿•) - 03-07-2010, 08:06 PM #9
Thanks for info.
- 03-07-2010, 08:06 PM #10
- 03-07-2010, 08:16 PM
Thread Author #11
No need to thank me man. Believe it or not, I'll be just as happy when beezy420 kernel comes out as you are. Everyone tells me i should have been a teacher, instead of a bum lol.
Ubuntu is smaller and runs a bit faster. This needs to be a pretty bare install for building software, so Ubuntu/Gnome is actually a better choice. When we get into editing and building images so you can plop your kernel in place of someone else's, that's a good time for Kubuntu if you prefer KDE.(•‿•) - 03-07-2010, 08:23 PM #12
- 03-07-2010, 08:40 PM
Thread Author #13
I've always used Gnome, but I know what you mean. KDE can look pretty damn slick and do things Windows users can only dream of.
Having said that, Gnome with compiz/emerald can be amazing looking as well.
Just trust me and leave this one pretty bare and basic lol. When the day comes that you want to build the whole Android OS from source (and you will) you will be happy you kept a lean and ugly install on your hard drive
(•‿•) - 03-07-2010, 08:56 PM #14
- 03-07-2010, 11:15 PM #15
can't wait for post number 5 gb.
- 03-08-2010, 12:02 AM
Thread Author #16
coming soon (hope for tomorrow). Feet up by the fire and my evening cigar and Wild Turkey on the coffee table for the evening
(•‿•) - 03-08-2010, 08:56 AM #17
Gbhil - thanks for tutorials, this will really help a lot of us out! By the way, since Linux Mint in built on Ubuntu, I would presume the said instructions (commands) in the first post and such should work, right?
As always, your HOW-TO's are very much appreciated and benefit us all. Thanks again! - 03-08-2010, 02:43 PM
Thread Author #18
Beats me lol. Depending on the version of the toolchain on Mint it might work, or it might not. Make sure you have jre 1.5 and we will assume the rest works.
That's the problem with a step-by-step tutorial, you have to base it on one version of the software. If mint doesn't work out of the box, it can be made to work with some trial and error.(•‿•) - 03-08-2010, 03:08 PM #19
- 03-09-2010, 08:52 PM
Thread Author #20
Bump for anyone interested. Some updates
(•‿•) - 03-09-2010, 10:00 PM #21
- 03-09-2010, 10:04 PM
Thread Author #22
Not really. Ubuntu is NOT the way to learn "Hardcore" Linux as it changes quite a bit from it's original roots, but it is pretty damn user friendly.
try downloading the latest ISO and running it from the cd for a test drive. You don't have to install to test that way.(•‿•) - 03-09-2010, 10:11 PM #23
- 03-09-2010, 10:18 PM
Thread Author #24
(•‿•) - 03-09-2010, 10:20 PM #25





Reply

Make sure it's 9.04 . This is just the tip of the iceburg. Darkshneider Kernel package is is the goal.



































