Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,740,807 Members 53,140 Now Online
XDA Developers Android and Mobile Development Forum

[Android] TouchPad Android kernel mini howto

Tip us?
 
s7mx1
Old
(Last edited by s7mx1; 23rd November 2011 at 11:57 PM.) Reason: Update alpah3
#1  
Junior Member - OP
Thanks Meter 19
Posts: 24
Join Date: Jul 2009

 
DONATE TO ME
Default [Android] TouchPad Android kernel mini howto

It seems there is little information on the internet regarding how to compile the kernel and how to convert to the correct image format so the boot loader will recognise and how to transfer it over to the touchpad. I ended up spent a few hours and finally figured out. I hope this will be useful for someone. I will try to make it concise as this is mainly aimed for developers.

What you will need


Prepare

Download CM7 Alpha 3 image and extract the boot.img to a temporary place.
Download Sourcery G++ Lite and install it. Add the G++ Lite tool chain binaray path to the PATH env variable. Get the kernel source from git hub and extract to local disk and change directory to the kernel source.

Compile the kernel
Still in the kernel source directory run
Code:
Select Code
make  ARCH=arm CROSS_COMPILE=arm-none-eabi- tenderloin_android_defconfig
make ARCH=arm CROSS_COMPILE=arm-none-eabi- uImage
Prepare the initramfs U-boot image
Extract the initramfs from the boot.img saved in temporary folder and convert it to uboot-image format
Code:
Select Code
dd if=boot.img bs=1 skip=3577748 of=img.gz
mkimage -A arm -O linux -T ramdisk -C none -a 0x60000000 -e 0x60000000 -n "Image" -d ./img.gz arch/arm/boot/uRamdisk
(The dd offset for alpha 2.1 image is 3561152)

Combine the kernel and initramfs into a single U-boot image
Create a combined U-boot image (kernel and initramfs)
Code:
Select Code
mkimage -A arm -O linux -T multi -a 0x40208000  -e  0x40208000 -C none -n "multi image" -d arch/arm/boot/uImage:arch/arm/boot/uRamdisk  uImage.CyanogenMod.new
Transfer it to the device
Boot your touchpad into recovery mode and run
Code:
Select Code
adb shell mount /dev/block/mmcblk0p13 /boot
adb push uImage.CyanogenMod.new /boot/uImage.CyanogenMod.new
adb shell umount /boot
adb shell reboot
After it reboot you should be able to see a new CyanogenMod.new item from the boot menu.

That's it!


Optimisation
For those who wants to experiment with GCC build options you can update the entry "arch-$(CONFIG_CPU_32v7" in file arch/arm/Makefile and I set mine to
Code:
Select Code
arch-$(CONFIG_CPU_32v7)         :=-D__LINUX_ARM_ARCH__=7  -mtune=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=softfp -O2 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a)
Warning
Please be aware you are working on the bleeding edge kernel for touchpad and there is no guarantee that the latest git version will work for you. Please try an earlier version if that's the case.
As of 2011-11-23 you will need the latest kernel source to build kernel for alpha 3. Please do not mix the kernel with an initramfs from a different version, i.e. don't use initramfs extracted from alpha 2.1 and use it with alpha3.
The Following 10 Users Say Thank You to s7mx1 For This Useful Post: [ Click to Expand ]
 
Leoisright
Old
#2  
Leoisright's Avatar
Recognized Developer
Thanks Meter 6886
Posts: 4,825
Join Date: Dec 2010
Location: MN

 
DONATE TO ME
Thanks for this. Last weekend spent a while trying to figure this out.

Sent from my HP Touchpad using Tapatalk
Device: Samsung Note 2 and Samsung Nexus 10
Device: Microsoft Surface
Device: Samsung Tab 3 7"
ROM: S5 4.4.2 w/note 3 mods
Kernel: Stock

Nexus 10 Developement

Have helped with many mods and roms over the past 4 years. Devices I've helped include Evo 4G, Evo 4G LTE, Evo 3D, Note 2, HP Touchpad, and Nexus 10

Many thanks to Myn, Virus, Chubbzlou, Ewalk, TMartin, TommyTomatoe, CM, Sac, Platty, XDA, and so many more for helping me over the years to refine my skills
 
myn
Old
#3  
myn's Avatar
Senior Recognized Developer
Thanks Meter 4002
Posts: 2,658
Join Date: Nov 2007

 
DONATE TO ME
x2. Huge thanks
 
Divine_Madcat
Old
#4  
Divine_Madcat's Avatar
Forum Moderator
Thanks Meter 2214
Posts: 2,576
Join Date: Sep 2005
Location: USA
Thank you soooooo much for this guide. Quick question if you don't mind though.. I am using an mkimage that goes back to my nook kernel days. Is there anything newer out, or would this still be ok,?


My Phones:
HTC Blue Angel (retired)
HTC x7501 (retired)
HTC Incredible, w/ AOKP (GPS use)
HTC Rezound (backup phone)
Samsung Galaxy S4 w/ GPE 4.4.2

My Tablets
B&N Nook Color, w/ CM10
HP Touchpad w/ CM10
Google Nexus 7 w/ Stock Rom (STOLEN.... )
Google Nexus 7 (2013) w/ Stock Rom & Glitch Kernel

If you have any problems or questions, do not hesitate to ask. I don't bite!
 
s7mx1
Old
#5  
Junior Member - OP
Thanks Meter 19
Posts: 24
Join Date: Jul 2009

 
DONATE TO ME
Quote:
Originally Posted by Divine_Madcat View Post
Thank you soooooo much for this guide. Quick question if you don't mind though.. I am using an mkimage that goes back to my nook kernel days. Is there anything newer out, or would this still be ok,?
As long as the mkimage can generate a standard U-boot image it should be fine.

You can always try it yourself. In worst case you have to hard reboot the touchpad by pressing the power button and home button at the same time for more than 10 minutes. As long as you keep the original image files (UImage.*) untouched I don't think you can brick it even if you want to.
 
Divine_Madcat
Old
#6  
Divine_Madcat's Avatar
Forum Moderator
Thanks Meter 2214
Posts: 2,576
Join Date: Sep 2005
Location: USA
S7

I have been trying to compile the kernel for some time now, and was hopeful reading your guide (and this last post) However, still following the steps to merge the ramdisk, i cannot make a booting kernel. I can get it flashed, as i am using the update.zip method, but moboot always gives me a crc error when booting it.

Though, before i totally go nuts, i think i need to try the source forgery toolchain, as i am using the Android ndk r6b...


My Phones:
HTC Blue Angel (retired)
HTC x7501 (retired)
HTC Incredible, w/ AOKP (GPS use)
HTC Rezound (backup phone)
Samsung Galaxy S4 w/ GPE 4.4.2

My Tablets
B&N Nook Color, w/ CM10
HP Touchpad w/ CM10
Google Nexus 7 w/ Stock Rom (STOLEN.... )
Google Nexus 7 (2013) w/ Stock Rom & Glitch Kernel

If you have any problems or questions, do not hesitate to ask. I don't bite!
 
s7mx1
Old
#7  
Junior Member - OP
Thanks Meter 19
Posts: 24
Join Date: Jul 2009

 
DONATE TO ME
Quote:
Originally Posted by Divine_Madcat View Post
S7

I have been trying to compile the kernel for some time now, and was hopeful reading your guide (and this last post) However, still following the steps to merge the ramdisk, i cannot make a booting kernel. I can get it flashed, as i am using the update.zip method, but moboot always gives me a crc error when booting it.

Though, before i totally go nuts, i think i need to try the source forgery toolchain, as i am using the Android ndk r6b...
Could you check the md5sum of the u-boot image crated on disk and the one installed by update.zip file? Do they match? If they do then you probably will need to upgrade your mkimage tool.
The Following User Says Thank You to s7mx1 For This Useful Post: [ Click to Expand ]
 
Divine_Madcat
Old
#8  
Divine_Madcat's Avatar
Forum Moderator
Thanks Meter 2214
Posts: 2,576
Join Date: Sep 2005
Location: USA
Quote:
Originally Posted by s7mx1 View Post
Could you check the md5sum of the u-boot image crated on disk and the one installed by update.zip file? Do they match? If they do then you probably will need to upgrade your mkimage tool.
I will give it a check; just in case, know where to get a newer mkimage?


My Phones:
HTC Blue Angel (retired)
HTC x7501 (retired)
HTC Incredible, w/ AOKP (GPS use)
HTC Rezound (backup phone)
Samsung Galaxy S4 w/ GPE 4.4.2

My Tablets
B&N Nook Color, w/ CM10
HP Touchpad w/ CM10
Google Nexus 7 w/ Stock Rom (STOLEN.... )
Google Nexus 7 (2013) w/ Stock Rom & Glitch Kernel

If you have any problems or questions, do not hesitate to ask. I don't bite!
 
decalex
Old
#9  
decalex's Avatar
Recognized Themer
Thanks Meter 1446
Posts: 3,059
Join Date: Apr 2009
Location: Orange County, CA

 
DONATE TO ME
Thanks so much for this guide

Quote:
Originally Posted by s7mx1 View Post
You can always try it yourself. In worst case you have to hard reboot the touchpad by pressing the power button and home button at the same time for more than 10 minutes.
It feels like 10 mins.. doesn't it
Galaxy Note III KitKat 4.4.2 HyperDrive
 
Divine_Madcat
Old
(Last edited by Divine_Madcat; 11th November 2011 at 11:39 PM.)
#10  
Divine_Madcat's Avatar
Forum Moderator
Thanks Meter 2214
Posts: 2,576
Join Date: Sep 2005
Location: USA
WEll, i checked the MD5 sums, and it looks good. So, i guess it is time to try again with the toolchain listed here, and perhaps a new mkimage (if there is a "modern" one i should using, please point me to it...)

edit: Never mind.. in all my looking, i never saw that ubuntu had a nice one waiting for me.... doh
edit2: Woo! After getting the probably correct mkimage, and the CS toolchain, looks like i finally got it to pass the crc check. Now, lets see if it finishes booting. Thanks again for the guide!

Nope.. no boot. I get a dmesg with this:
<3>[ 69.978716] init: untracked pid 224 exited
<6>[ 70.086076] android_usb gadget: high speed config #1: android
<6>[ 70.086209] gadget_event: schedule host_connected
<6>[ 70.096953] max8903b_current_setup: CURRENT_500MA
<6>[ 70.097040] gadget_event: source=bus mA=500 (no change)
<4>[ 70.910953] UDC-CHG (2-2-2): usb_multi_chg_detect (591) : USB host Adaptor
(500mA)!
<6>[ 70.912805] gadget_event: schedule host_disconnected
<6>[ 70.925482] max8903b_current_setup: CURRENT_ZERO
<6>[ 71.164066] android_usb gadget: high speed config #1: android
<6>[ 71.164220] gadget_event: schedule host_connected
<6>[ 71.173640] max8903b_current_setup: CURRENT_500MA
<6>[ 71.178212] gadget_event: source=bus mA=500 (no change)
<6>[ 72.160955] gadget_event: host_connected=1 (no change)
<6>[ 74.142224] request_suspend_state: wakeup (0->0) at 74121495501 (2011-11-1
1 22:49:33.378031648 UTC)
<3>[ 74.143675] init: untracked pid 266 exited
<3>[ 74.155217] init: untracked pid 273 exited
<6>[ 79.285016] request_suspend_state: wakeup (0->0) at 79264287462 (2011-11-1
1 22:49:38.520824942 UTC)

The last three lines repeat alot, with different pid's .


Alrighty.. figured this one out - You cannot use the latest repository commits with the 2.1 alpha build. However, i was able to build commit fd70bb7aae, and it builds and actually boots. Now, i can actually play around and tweak it. Thank you again for the guide, and sorry for the edit spamming.. heh.


My Phones:
HTC Blue Angel (retired)
HTC x7501 (retired)
HTC Incredible, w/ AOKP (GPS use)
HTC Rezound (backup phone)
Samsung Galaxy S4 w/ GPE 4.4.2

My Tablets
B&N Nook Color, w/ CM10
HP Touchpad w/ CM10
Google Nexus 7 w/ Stock Rom (STOLEN.... )
Google Nexus 7 (2013) w/ Stock Rom & Glitch Kernel

If you have any problems or questions, do not hesitate to ask. I don't bite!

The Following User Says Thank You to Divine_Madcat For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


TRENDING IN THEMER...