Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    offline 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

    Code:
    $ 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
    Get the Kernel sources for your device from https://opensource.motorola.com/sf/g...s.cliqdext/frs
    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

    Code:
    $ 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
    This should leave a directory structure like this under ~/motorola-source

    Code:
    $ ls ~/motorola-source
    base  bionic  bootable  build  dalvik  external  frameworks  kernel  libhardware  libhardware_legacy  Makefile  msm7k  out  prebuilt  README.txt  system  unpack.pl  vendor
    Now lets get the prerequisites stated at ~/motorola-source/README.txt


    Once you have downloaded all of previous requirements you will need to download several things from android to do this:

    Code:
    $ 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
    Get ready to wait a while because de prebuilt repository is quite big
    Once all of the above have finished lets set the prerequisites to the TAGS specified in the README.txt

    Code:
    $ 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
    Once you've done this copy all the directories to ~/motorola-source

    Code:
    $ cp -r base libhardware libhardware_legacy msm7k prebuilt ~/motorola-source
    Now we have to unpack what comes in the sources from motorola

    Code:
    $ cd ~/motorola-source
    $ chmod +x unpack.pl
    $ ./unpack.pl
    Now you have everything that's needed to compile your kernel
    You have to set some variables first

    Code:
    $ 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:
    Now lets build
    Code:
    cd /kernel 
    $ make msm_mot_defconfig
    This line will build the kernel and output a zImage
    Code:
    $ make ANDROID_BUILD_TOP=
    This will build the wireless driver module dhd.ko
    Code:
    $ make -C /system/wlan/bcm/osrc/open-src/src/dhd/linux ANDROID_BUILD_TOP=
    Now you have build your kernel!
    results should be
    Code:
    ~/motorola-source/kernel/arch/arm/boot/zImage
    ~/motorola-source/system/wlan/bcm/osrc/open-src/src/dhd/linux/dhd.ko
    In order to flash this to your system you will need
    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

    Code:
    $ mkdir ~/bin
    $ unzip unpack-bootimg.zip -d ~/bin
    $ unzip repack-bootimg.zip -d ~/bin
    $ export PATH=:~/bin
    With your nandroid backup search for your boot.img and copy it somewhere easy to find

    Code:
    $ mkdir ~/mymoto
    $ cd ~/mymoto
    $ cp /path/to/my/nandroid/boot.img .
    Extract the boot image
    Code:
    $ unpack-bootimg.pl boot.img
    this will leave you with
    Code:
    $ ls ~/mymoto
    boot.img  boot.img-kernel.gz  boot.img-ramdisk  boot.img-ramdisk.cpio.gz
    Now lets repack that boot image with our new kernel

    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
    Code:
    # 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"
    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 all

    now erase /dev/mtd/mtd0
    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
    That's it now you have built and flashed your newly built kernel!
    Last edited by adlx; 05-17-2011 at 03:10 PM. Reason: Added $PATH variable

  2. 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)

  3. #2
    adlx's Avatar
    online Maker of adlxmod
    Join Date
    Jan 2010
    Location
    Madrid, Spain
    Posts
    1,034
    Thanks
    610
    Thanked 1,485 Times in 366 Posts
    Downloads
    30
    Uploads
    0
    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.ko
    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)

  4. The Following User Says Thank You to adlx For This Useful Post:

    diego.carrera (04-25-2010)

  5. #3
    offline 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
    Code:
    ls ~/motorola-source
    and received this:
    Code:
    bionic    build   external    kernel    prebuilt    system     vendor
    bootable  dalvik  frameworks  Makefile  README.txt  unpack.pl
    on input

    Code:
    git clone git://git://android.git.kernel.org/platform/prebuilt.git
    I receive output

    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.

  6. #4
    offline Maybe Modder
    Join Date
    Apr 2010
    Posts
    20
    Thanks
    9
    Thanked 23 Times in 3 Posts
    Downloads
    4
    Uploads
    0
    The problem is this

    Code:
    git clone git://git://android.git.kernel.org/platform/prebuilt.git
    it should be
    Code:
    git clone git://android.git.kernel.org/platform/prebuilt.git
    It is fixed now on the original!
    Last edited by diego.carrera; 04-25-2010 at 08:43 PM.

  7. #5
    offline 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.

  8. #6
    adlx's Avatar
    online Maker of adlxmod
    Join Date
    Jan 2010
    Location
    Madrid, Spain
    Posts
    1,034
    Thanks
    610
    Thanked 1,485 Times in 366 Posts
    Downloads
    30
    Uploads
    0
    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)

  9. #7
    adlx's Avatar
    online Maker of adlxmod
    Join Date
    Jan 2010
    Location
    Madrid, Spain
    Posts
    1,034
    Thanks
    610
    Thanked 1,485 Times in 366 Posts
    Downloads
    30
    Uploads
    0
    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. #8
    offline 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.

  11. #9
    adlx's Avatar
    online Maker of adlxmod
    Join Date
    Jan 2010
    Location
    Madrid, Spain
    Posts
    1,034
    Thanks
    610
    Thanked 1,485 Times in 366 Posts
    Downloads
    30
    Uploads
    0
    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)

  12. #10
    offline Maybe Modder
    Join Date
    Apr 2010
    Posts
    20
    Thanks
    9
    Thanked 23 Times in 3 Posts
    Downloads
    4
    Uploads
    0
    Thnx for the sticky!

  13. #11
    offline 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

  14. #12
    offline 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

  15. #13
    csolanol's Avatar
    offline So I Hear You Can Mod
    Join Date
    Feb 2010
    Posts
    209
    Thanks
    20
    Thanked 128 Times in 59 Posts
    Downloads
    16
    Uploads
    0
    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.git
    Phone: Dext (rooted) Operator: Vodafone Espaņa
    ROM: CM4Morrison (custom kernel 2.6.29-6)
    Recovery: ClockWorkMod
    Theme: Launcher Pro.
    Follow me on twitter
    Donate:

  16. #14
    offline 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?

  17. #15
    nachobkc's Avatar
    offline So I Hear You Can Mod
    Join Date
    Apr 2009
    Location
    Rosario
    Posts
    141
    Thanks
    160
    Thanked 31 Times in 15 Posts
    Downloads
    21
    Uploads
    0
    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

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •