Android源码编译(一)----------->TI-Android-GingerBread-2.3-DevKit-1.0 系统定制(just for beagleboard xm Rev B)

================================================================

转载请注明出处

================================================================


1.Installing the JDK

The Sun JDK is no longer in Ubuntu's main package repository. In order to download it, you need to add the appropriate repository and indicate to the system which JDK should be used.

Java 6: for Gingerbread and newer

$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk

Java 5: for Froyo and older

$ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu dapper main multiverse"
$ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu dapper-updates main multiverse"
$ sudo apt-get update
$ sudo apt-get install sun-java5-jdk


NOTE: Android Gingerbread (2.3) needs Java 6 on ubuntu, whereas the previous version FroYo (2.2) was using Java 5. 

(也可以直接下载:Eclipse---> http://www.eclipse.org/downloads/packages/release/galileo/sr2

JDK6----> http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u27-download-440405.html

android SDK:-----> http://developer.android.com/sdk/index.html)

2.Installing required packages

To set up your development environment, install the following required packages:

$sudo apt-get install git-core gnupg gperf libsdl-dev libesd0-dev

$sudo apt-get install libwxgtk2.6-dev zip curl minicom tftpd

$sudo apt-get install uboot-mkimage libx11-dev libncurses-dev

$sudo apt-get install expect bison build-essential flex zlib1g-dev


3.Installing Repo


Repo is a tool that makes it easier to work with Git in the context of Android. For more information about Repo, seeVersion Control.

To install, initialize, and configure Repo, follow these steps:

  • Make sure you have a bin/ directory in your home directory, and that it is included in your path:

    $ mkdir ~/bin
    $ vim ~/.bashrc
    $ source ~/.bashrc

  • Download the Repo script and ensure it is executable:

    $ curl https://android.git.kernel.org/repo > ~/bin/repo
    $ chmod a+x ~/bin/repo
  • The MD5 checksum for repo is bbf05a064c4d184550d71595a662e098

4.Initializing a Repo client

After installing Repo, set up your client to access the android source repository:

Create an empty directory to hold your working files:


  $ mkdir rowboat-android
  $ cd rowboat-android

To check out a branch other than "master", specify it with -b or -m:
$ repo init -u git://gitorious.org/rowboat/manifest.git -m TI-Android-GingerBread-2.3-DevKit-1.0.xml
$ repo sync

Initializing project bionic ...
remote: Counting objects: 5927, done.
remote: Compressing objects: 100% (2235/2235), done.
remote: Total 5927 (delta 4097), reused 5384 (delta 3631)
Receiving objects: 100% (5927/5927), 2.44 MiB | 57 KiB/s, done.
Resolving deltas: 100% (4097/4097), done.   。。。。(它就开是同步下载源码了!开心吧,你趁现在去喝杯咖啡吧!)

5.Verifying Git Tags

Load the following public key into your GnuPG key database. The key is used to sign annotated tags that represent releases.

$ gpg --import

Copy and paste the key(s) below, then enter EOF (Ctrl+D) to end the input and process the keys.

-----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-----

Android源码编译(一)----------->TI-Android-GingerBread-2.3-DevKit-1.0 系统定制(just for beagleboard xm Rev B)_第1张图片

源码Tree 下载结束后,会有以下的文件:

This will generate the sources for

  • Android File system
  • Android Linux Kernel (in kernel directory)
  • u-boot boot loader (in u-boot-omap3 directory)
  • x-loader (in x-load-omap3 directory)
  • Toolchain (prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/bin)

6.Tool chain setup

Setup the tool-chain path to point to arm-eabi- tools in prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/bin

  $ export PATH=~/rowboat-android/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/bin:$PATH

7.Compilation procedure(编译步骤)

To build x-loader

Execute the following commands

  $ make CROSS_COMPILE=arm-eabi- distclean
  $ make CROSS_COMPILE=arm-eabi- omap3beagle_config
  $ make CROSS_COMPILE=arm-eabi-

This command will build the x-loader Image "x-load.bin"

To create the MLO file used for booting from a MMC/SD card, sign the x-loader image using the signGP tool found in the Tools/signGP directory of the Devkit.

  $ ./signGP ./x-load.bin

The signGP tool will create a .ift file, rename the x-load.bin.ift to MLO

  $ mv x-load.bin.ift MLO

To build boot loader (u-boot)

  • Change directory to u-boot-omap3
  $ cd u-boot-omap3
  • Do the following to build u-boot for AM37x / DM3730 EVM
  $ make CROSS_COMPILE=arm-eabi- distclean
  $ make CROSS_COMPILE=arm-eabi- omap3_beagle_config
  $ make CROSS_COMPILE=arm-eabi- 

This command will generate the u-boot Image "u-boot.bin"

NOTE: Copy the "mkimage" from "tools" folder to ~/usr/bin folder on your host machine, this is needed for kernel uImage generation

To build Linux kernel

  • Change directory to kernel
  $ cd kernel
  • Do the following to build sources for AM37x/DM3730 EVM
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- distclean
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- omap3_beagle_android_defconfig
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- uImage

This will generate uImage (kernel image) in kernel/arch/arm/boot folder

To build Android filesystem

To Build the root file system for AM37x and DM37x (Beagle XM, AM37x/DM37x REV G EVM)


  $ make TARGET_PRODUCT= <product name> OMAPES=5.x -j8

e.g:$ make TARGET_PRODUCT=beagleboard OMAPES=5.x -j4

NOTE: product name can be beagleboard or omap3evm or am3517evm

Prepare the root filesystem:


  $ cd out/target/product/beagleboard
  $ mkdir android_rootfs
  $ cp -r root/* android_rootfs
  $ cp -r system android_rootfs
  $ sudo ../../../../build/tools/mktarball.sh ../../../host/linux-x86/bin/fs_get_stats android_rootfs . rootfs rootfs.tar.bz2

The rootfs.tar.bz2 is the android filesystem, it can be put on a SD/MMC Card or used our NFS.

To generate SD/MMC card to boot Android

These compiled Images can be copied to a SD / MMC card to boot Android on AM37x EVM

  • Generate boot.scr using mk-bootscr from tools folder
  $ ./mkbootscr
  • Copy all the images to one folder
  $ mkdir image_folder
  $ cp kernel/arch/arm/boot/uImage image_folder
  $ cp u-boot-omap3/u-boot.bin image_folder
  $ cp x-loader-omap3/MLO image_folder
  $ cp Tools/mk-bootscr/boot.scr image_folder
  $ cp out/target/product/omap3evm/rootfs.tar.bz2 image_folder
  $ cp media_clips image_folder 
  $ cp Tools/mk-mmc/mkmmc-android.sh image_folder 
  $ ./mkmmc-android <sd card mounted dev folder example:/dev/sdc> MLO u-boot.bin uImage boot.scr rootfs.tar.bz2 Media_Clips

>     netcfg                                                                        
       lo       UP    127.0.0.1       255.0.0.0       0x00000049                       
       eth0     UP    172.24.190.59   255.255.252.0   0x00001043  

>    netcfg usb0 dhcp   -- if u have dhcp enabled network this will assign ip to yuor beagle board dynamically

>   getprop net.usb0.dns1 -- This will give u the ip of the router 

>  setprop net.dns1 (IP-- which u get from previous commnad)




8.Installation RowboPERF

The RowboPERF application is already integrated to the pre-built file systems provided as part of Android FroYo DevKit. When building from sources, RowboPERF applications need to be integrated to the filesystem before preparing the rootfs tarball.

  • Extract the Performance_Apps.tar.gz to some suitable director
   #> tar -xvzf ~/Performance_Apps.tar
  • Assume <rowboat-source>/out/target/product/omap3evm/android_rootfs is the android rootfs directory, Invoke the install_rowboperf.sh script provided inside the RowboPERF package pr android_rootfs directory as arguement.
   #> cd ~/Performance_Apps
   #> ./install_rowboperf.sh ~/rowboat-android/out/target/product/beagleboard/android_rootfs
 $ sudo ../../../../build/tools/mktarball.sh ../../../host/linux-x86/bin/fs_get_stats android_rootfs . rootfs rootfs.tar.bz2

The rootfs.tar.bz2 is the android filesystem, it can be put on a SD/MMC Card or used our NFS.
























   

你可能感兴趣的:(android,image,File,Build,tools,Deb)