- 04-25-2010, 12:07 PM #1
Maybe Modder
- Join Date
- Apr 2010
- Posts
- 20
- Thanks
- 9
- Thanked 23 Times in 3 Posts
- Downloads
- 4
- Uploads
- 0
HOWTO: Build and Flash Motorola's kernel from source
DISCLAIMER:
I'm not responsible for any damages done to your phone. Please read carefully, and also please, please do a nandroid backup.
If any of the following fails, don't continue. And post your errors on this thread.
Prepare your system
Get the Kernel sources for your device from https://opensource.motorola.com/sf/g...s.cliqdext/frsCode:$ sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev
Be sure to download the one for your CLIQ/DEXT, if you compile other than the one intended for your device you will be left in 1969!! (DISCO!).
Note: The latest for TMO, is split in 3 files, download all of them.
Once you have downloaded all your files
This should leave a directory structure like this under ~/motorola-sourceCode:$ mkdir ~/motorola-source $ gunzip morrison-customer-tmo-1_4-release-1_4_8-framework.tar.gz $ tar xvf morrison-customer-tmo-1_4-release-1_4_8-framework.tar -C ~/motorola-source $ gunzip morrison-customer-tmo-1_4-release-1_4_8-external.tar.gz $ tar xvf morrison-customer-tmo-1_4-release-1_4_8-external.tar -C ~/motorola-source $ gunzip morrison-customer-tmo-1_4-release-1_4_8-kernel.tar.gz $ tar xvf morrison-customer-tmo-1_4-release-1_4_8-kernel.tar -C ~/motorola-source
Now lets get the prerequisites stated at ~/motorola-source/README.txtCode:$ ls ~/motorola-source base bionic bootable build dalvik external frameworks kernel libhardware libhardware_legacy Makefile msm7k out prebuilt README.txt system unpack.pl vendor
Once you have downloaded all of previous requirements you will need to download several things from android to do this:
Get ready to wait a while because de prebuilt repository is quite bigCode:$ mkdir ~/moto-prerquisites $ cd ~/moto-prerquisites $ git clone git://android.git.kernel.org/platform/frameworks/base.git $ git clone git://android.git.kernel.org/platform/hardware/libhardware.git $ git clone git://android.git.kernel.org/platform/hardware/libhardware_legacy.git $ git clone git://android.git.kernel.org/platform/hardware/msm7k.git $ git clone git://android.git.kernel.org/platform/prebuilt.git
Once all of the above have finished lets set the prerequisites to the TAGS specified in the README.txt
Once you've done this copy all the directories to ~/motorola-sourceCode:$ cd ~/moto-prerquisites/base $ git checkout android-1.5r3 $ cd ~/moto-prerquisites/libhardware $ git checkout android-1.5r3 $ cd ~/moto-prerquisites/libhardware_legacy $ git checkout android-1.5r3 $ cd ~/moto-prerquisites/msm7k $ git checkout android-1.6_r1 $ cd ~/moto-prerquisites/prebuilt $ git checkout android-1.5r3
Now we have to unpack what comes in the sources from motorolaCode:$ cp -r base libhardware libhardware_legacy msm7k prebuilt ~/motorola-source
Now you have everything that's needed to compile your kernelCode:$ cd ~/motorola-source $ chmod +x unpack.pl $ ./unpack.pl
You have to set some variables first
Now lets buildCode:$ export PLATFORM_DIR=~/motorola/source $ export ARCH=arm $ export CROSS_COMPILE=arm-eabi- $ export PATH=/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin:
This line will build the kernel and output a zImageCode:cd /kernel $ make msm_mot_defconfig
This will build the wireless driver module dhd.koCode:$ make ANDROID_BUILD_TOP=
Now you have build your kernel!Code:$ make -C /system/wlan/bcm/osrc/open-src/src/dhd/linux ANDROID_BUILD_TOP=
results should be
In order to flash this to your system you will needCode:~/motorola-source/kernel/arch/arm/boot/zImage ~/motorola-source/system/wlan/bcm/osrc/open-src/src/dhd/linux/dhd.ko
A nandroid backup and unpack-bootimg.pl and repack-bootimg.pl get them from here http://android-dls.com/wiki/index.ph...ck_Boot_Images
With your nandroid backup search for your boot.img and copy it somewhere easy to findCode:$ mkdir ~/bin $ unzip unpack-bootimg.zip -d ~/bin $ unzip repack-bootimg.zip -d ~/bin $ export PATH=:~/bin
Extract the boot imageCode:$ mkdir ~/mymoto $ cd ~/mymoto $ cp /path/to/my/nandroid/boot.img .
this will leave you withCode:$ unpack-bootimg.pl boot.img
Now lets repack that boot image with our new kernelCode:$ ls ~/mymoto boot.img boot.img-kernel.gz boot.img-ramdisk boot.img-ramdisk.cpio.gz
Code:$ cd ~/mymoto $ repack-bootimg.pl ~/motorola-source/kernel/arch/arm/boot/zImage boot.img-ramdisk my-boot.img
//You'll need android-sdk installed to use adb search the forums on how to install android-sdk
Now push your image and wireless driver to your phone
Code:$ adb push my-boot.img /sdcard/ $ adb push ~/motorola-source/system/wlan/bcm/osrc/open-src/src/dhd/linux/dhd.ko /system/lib/ $ adb shell
Now let's see where we should flash our image
As we can see mtd0 is where our boot image is stored, be sure to checkout wich one corresponds to your phone but it should be the same for allCode:# cat /proc/mtd dev: size erasesize name mtd0: 00300000 00020000 "boot" mtd1: 08ac0000 00020000 "system" mtd2: 0df80000 00020000 "userdata" mtd3: 00040000 00020000 "misc" mtd4: 00500000 00020000 "recovery" mtd5: 06000000 00020000 "cache" mtd6: 00080000 00020000 "splash"
now erase /dev/mtd/mtd0
That's it now you have built and flashed your newly built kernel!Code:# cat /dev/zero > /dev/mtd/mtd0 write: No space left on device [this is ok, you can ignore] # flash_image boot /sdcard/my-boot.img # reboot
Last edited by adlx; 05-17-2011 at 03:10 PM. Reason: Added $PATH variable
-
12 Users Say Thank You to diego.carrera For This Useful Post
adlx (04-25-2010), denkai (04-25-2010), firesnatch (04-22-2011), j_r0dd (04-25-2010), lioks (04-25-2010), lucas.hohmann (04-25-2010), mad_fitter (02-16-2011), nachobkc (12-07-2010), OCM (04-25-2010), sudo.adam (07-22-2010), tep065 (04-25-2010), tonymy01 (10-12-2010)
- 04-25-2010, 02:19 PM #2
you'll need to remount /system RW before copying dhd.ko to /system/lib, adb remount or by running rwsystem.
I'd also check for permission of /system/lib/dhd.ko after pushing it. If not correct, change them back to 644 (actually, it's not really necesarry as module is loaded by root, but I like to let them as is)
# ls -a -l /system/lib/dhd.ko
ls -a -l /system/lib/dhd.ko
-rw-r--r-- root root 198756 1970-01-01 01:39 dhd.koDownload my 1-click Recovery Flasher to flash a custom or stock recovery to your phone: Cliq, CliqXT, Backflip, ...
Like my work? Support me:
& visit my adlxmod site and follow me on Twitter
Tambien me puedes encontrar en Movilzona (Esp)
-
The Following User Says Thank You to adlx For This Useful Post:
diego.carrera (04-25-2010)
- 04-25-2010, 06:28 PM #3
Of Mice and Modders
- Join Date
- May 2007
- Posts
- 98
- Thanks
- 34
- Thanked 14 Times in 7 Posts
- Downloads
- 80
- Uploads
- 0
After unpacking the motorola files I ran
and received this:Code:ls ~/motorola-source
on inputCode:bionic build external kernel prebuilt system vendor bootable dalvik frameworks Makefile README.txt unpack.pl
I receive outputCode:git clone git://git://android.git.kernel.org/platform/prebuilt.git
Code:Initialized empty Git repository in /home/ryan/prebuilt/.git/ fatal: Unable to look up git (port <none>) (Servname not supported for ai_socktype)
Last edited by denkai; 04-25-2010 at 06:34 PM.
- 04-25-2010, 08:41 PM #4
Maybe Modder
- Join Date
- Apr 2010
- Posts
- 20
- Thanks
- 9
- Thanked 23 Times in 3 Posts
- Downloads
- 4
- Uploads
- 0
The problem is this
it should beCode:git clone git://git://android.git.kernel.org/platform/prebuilt.git
It is fixed now on the original!Code:git clone git://android.git.kernel.org/platform/prebuilt.git
Last edited by diego.carrera; 04-25-2010 at 08:43 PM.
- 04-25-2010, 08:50 PM #5
Of Mice and Modders
- Join Date
- May 2007
- Posts
- 98
- Thanks
- 34
- Thanked 14 Times in 7 Posts
- Downloads
- 80
- Uploads
- 0
yea... I noticed it, just figured I'd let you know. No better way then to show I did it exactly lol.
- 04-27-2010, 02:44 PM #6
When you run:
$ git clone git://android.git.kernel.org/platform/frameworks/base.git
$ git clone git://android.git.kernel.org/platform/hardware/libhardware.git
$ git clone git://android.git.kernel.org/platform/hardware/libhardware_legacy.git
$ git clone git://android.git.kernel.org/platform/hardware/msm7k.git
$ git clone git://android.git.kernel.org/platform/prebuilt.git
it will create all the following structure:
base/
libhardware/
libhardware_legacy/
msm7k/
prebuilt/
I believe the directories should better to be placed like in Android tree, which is:
frameworks/base/
hardware/libhardware/
hardware/libhardware_legacy/
hardware/msm7k/
prebuilt/Download my 1-click Recovery Flasher to flash a custom or stock recovery to your phone: Cliq, CliqXT, Backflip, ...
Like my work? Support me:
& visit my adlxmod site and follow me on Twitter
Tambien me puedes encontrar en Movilzona (Esp)
- 10-11-2010, 11:48 AM #7
Stickied!
Download my 1-click Recovery Flasher to flash a custom or stock recovery to your phone: Cliq, CliqXT, Backflip, ...
Like my work? Support me:
& visit my adlxmod site and follow me on Twitter
Tambien me puedes encontrar en Movilzona (Esp)
- 10-22-2010, 02:07 PM #8
Of Mice and Modders
- Join Date
- Aug 2010
- Location
- Mexico
- Posts
- 55
- Thanks
- 4
- Thanked 4 Times in 4 Posts
- Downloads
- 14
- Uploads
- 0
Please paste your .config kernel so we may look forwar for some enhancements.
- 10-24-2010, 05:49 AM #9
You can get the .config of a running kernel using this command:
zcat /proc/config.gz > /sdcard/config.txt
(Will work if the kernel is compiled with in .config support :-) ).
You can also use the extract-ikconfig script to extract from a kernel file.Download my 1-click Recovery Flasher to flash a custom or stock recovery to your phone: Cliq, CliqXT, Backflip, ...
Like my work? Support me:
& visit my adlxmod site and follow me on Twitter
Tambien me puedes encontrar en Movilzona (Esp)
- 10-28-2010, 05:05 PM #10
Maybe Modder
- Join Date
- Apr 2010
- Posts
- 20
- Thanks
- 9
- Thanked 23 Times in 3 Posts
- Downloads
- 4
- Uploads
- 0
Thnx for the sticky!
- 11-08-2010, 01:28 PM #11
Of Mice and Modders
- Join Date
- Aug 2010
- Location
- Mexico
- Posts
- 55
- Thanks
- 4
- Thanked 4 Times in 4 Posts
- Downloads
- 14
- Uploads
- 0
make -C /system/wlan/bcm/osrc/open-src/src/dhd/linux ANDROID_BUILD_TOP=
doestn work, in my case i shall place
make -C /system/wlan/bcm/osrc/open-src/src/dhd/linux ANDROID_BUILD_TOP=~/motorola-source
- 12-04-2010, 12:02 PM #12
So I Hear You Can Mod
- Join Date
- Jun 2010
- Posts
- 196
- Thanks
- 2
- Thanked 19 Times in 19 Posts
- Downloads
- 21
- Uploads
- 0
where are the pre requisites? i can t find them on source.android.com
- 12-04-2010, 12:07 PM #13
The first post says how to obtain them:
$ git clone git://android.git.kernel.org/platform/frameworks/base.git
$ git clone git://android.git.kernel.org/platform/hardware/libhardware.git
$ git clone git://android.git.kernel.org/platform/hardware/libhardware_legacy.git
$ git clone git://android.git.kernel.org/platform/hardware/msm7k.git
$ git clone git://android.git.kernel.org/platform/prebuilt.gitPhone: Dext (rooted) Operator: Vodafone Espaņa
ROM: CM4Morrison (custom kernel 2.6.29-6)
Recovery: ClockWorkMod
Theme: Launcher Pro.
Follow me on twitter
Donate:
- 12-05-2010, 07:01 AM #14
So I Hear You Can Mod
- Join Date
- Jun 2010
- Posts
- 196
- Thanks
- 2
- Thanked 19 Times in 19 Posts
- Downloads
- 21
- Uploads
- 0
thank you [MENTION=246072]saka[/MENTION]rino2k2
sorry, i misread it to say"read the prerequisites in the readme.txt and download them. Then do the git install commands" I need to sleep haha
also, if i install the prerequisites once, do i have to do it again?
- 12-09-2010, 05:26 PM #15
you rock guys... my promisse, when finish the final year exams ill build a functional kernel (with some help
)
llll Moto Atrix llll Root Acces llll CM 7 - fromheretothere
llll


LinkBack URL
About LinkBacks
Reply With Quote

