Post Reply

[Android] TouchPad Android kernel mini howto

OP s7mx1

4th November 2011, 05:17 PM   |  #1  
OP Junior Member
Thanks Meter: 19
 
24 posts
Join Date:Joined: Jul 2009
Donate to Me
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:
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:
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:
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:
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:
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.
Last edited by s7mx1; 23rd November 2011 at 11:57 PM. Reason: Update alpah3
The Following 10 Users Say Thank You to s7mx1 For This Useful Post: [ View ]
5th November 2011, 12:32 AM   |  #2  
Leoisright's Avatar
Recognized Developer
Flag MN
Thanks Meter: 6,902
 
4,832 posts
Join Date:Joined: Dec 2010
Donate to Me
More
Thanks for this. Last weekend spent a while trying to figure this out.

Sent from my HP Touchpad using Tapatalk
5th November 2011, 07:48 PM   |  #3  
myn's Avatar
Senior Recognized Developer
Thanks Meter: 4,002
 
2,658 posts
Join Date:Joined: Nov 2007
Donate to Me
x2. Huge thanks
9th November 2011, 06:25 PM   |  #4  
Divine_Madcat's Avatar
Forum Moderator
Flag USA
Thanks Meter: 2,246
 
2,598 posts
Join Date:Joined: Sep 2005
More
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,?
10th November 2011, 11:35 AM   |  #5  
OP Junior Member
Thanks Meter: 19
 
24 posts
Join Date:Joined: Jul 2009
Donate to Me
Quote:
Originally Posted by Divine_Madcat

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.
10th November 2011, 04:43 PM   |  #6  
Divine_Madcat's Avatar
Forum Moderator
Flag USA
Thanks Meter: 2,246
 
2,598 posts
Join Date:Joined: Sep 2005
More
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...
11th November 2011, 10:38 AM   |  #7  
OP Junior Member
Thanks Meter: 19
 
24 posts
Join Date:Joined: Jul 2009
Donate to Me
Quote:
Originally Posted by Divine_Madcat

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: [ View ]
11th November 2011, 02:49 PM   |  #8  
Divine_Madcat's Avatar
Forum Moderator
Flag USA
Thanks Meter: 2,246
 
2,598 posts
Join Date:Joined: Sep 2005
More
Quote:
Originally Posted by s7mx1

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?
11th November 2011, 06:07 PM   |  #9  
decalex's Avatar
Recognized Themer
Flag Orange County, CA
Thanks Meter: 1,448
 
3,076 posts
Join Date:Joined: Apr 2009
Donate to Me
More
Thanks so much for this guide

Quote:
Originally Posted by s7mx1

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
11th November 2011, 08:29 PM   |  #10  
Divine_Madcat's Avatar
Forum Moderator
Flag USA
Thanks Meter: 2,246
 
2,598 posts
Join Date:Joined: Sep 2005
More
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.
Last edited by Divine_Madcat; 11th November 2011 at 11:39 PM.

The Following User Says Thank You to Divine_Madcat For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in TouchPad Development by ThreadRank