android系统开发指南(常用环境的搭建和使用)

准备一台Linux 例如(ubuntu10.10)的PC

一  编译android源码,制作文件系统

1、下载android源码

(1)、  Downloading the Source Tree    Installing Repo

      mkdir ~/bin

      PATH=~/bin:$PATH

      curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo

      chmod a+x ~/bin/repo

 (2)、Initializing a Repo client

       mkdir WORKING_DIRECTORY

       cd WORKING_DIRECTORY

       repo init -u https://android.googlesource.com/platform/manifest

       下载特定版本的android源码可以用 -b来指定

        repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1

  (3)、Getting the files

       repo sync

    windows环境android源码下载:  http://yuanzhifei89.iteye.com/blog/1117549

2、kernel下载

    现在大家发现以前的Android 的Linux Kernel 下载方法不能用了,如下

    $ git clone git://android.git.kernel.org/kernel/common.git

    修改git为http后可以下载

    $ git clone https://android.googlesource.com/kernel/common


    总大下为400+MB,

    下载完成后可能发现common文件夹下什么也没有,

    $ git branch -a

    * master

    remotes/origin/HEAD -> origin/master

    remotes/origin/android-2.6.39

    remotes/origin/android-3.0

    remotes/origin/master

    $ git checkout  remotes/origin/android-3.0

   就可以看到基于linux 3.0的android内核了。

3、编译源码
   编译见http://www.cnblogs.com/mengshu-lbq/archive/2011/01/08/1930577.html

4、编译内核

  http://blog.csdn.net/wanjf_912/article/details/7597161

5、搭建网络开发环境

 1>  安装nfs服务器
     sudo apt-get install nfs-kernel-server nfs-common
2> 修改nfs服务器配置文件/etc/exports ,确保有以下配置项
    /nfsroot/rootfs *(rw,no_root_squash,sync)
   我们在内核中已经固定,手机通过网络方式启动,默认从 /nfsroot/rootfs
   读取文件系统,修改配置项后需要重启nfs服务器:
   sudo /etc/init.d/nfs-kernel-server restart
3> 配置网络根文件系统
  拷贝  out/target/product/littleton/root/  内容到  /nfsroot/rootfs 目录
  拷贝  out/target/product/littleton/system 内容到  /nfsroot/rootfs/system
  修改  /nfsroot/rootfs/init.rc 去掉几个mount命令

二   ubuntu下烧录内核和文件系统

1、硬件:
     手机一台
     usb转串口线一根
     usb转网卡线一根
2、软件环境

1> tftp 服务器
执行脚本: setup_tftpd.sh 安装和配置tftp服务器,我们默认以 /tftpboot 为 tftp服务器的根目录,需要下载的文件都放在该目录下。
3> 烧录镜像文件
用以下文件为例,示范通过tftp烧写内核和文件系统
内核           zImage0917
系统分区: system0918.img  
数据分区    data0918.img
待烧写的以上文件必须存在于tftp服务器根目录/tftpboot下。
具体步骤:
首先连接好硬件设备进入blob下载模式
1> blob 起来后按任意键
Processing obm parameters...
Can't detect micco. Set PMIC as normal I2C mode.
NAND flash(Manu=0x98 Device=0xba) detected!
Slot 0 Found
get relocation table
Found Main Bad block table at address 0x0f000000, version 0x01
Found Mirror Bad block table at address 0x0efc0000, version 0x01
Consider yourself BLOBed!
blob version 2.0.5-pre3 for Marvell Littleton
Copyright (C) 1999 2000 2001 2002 2003 Jan-Derk Bakker and Erik Mouw
blob comes with ABSOLUTELY NO WARRANTY; read the GNU GPL for details.
This is free software, and you are welcome to redistribute it
under certain conditions; read the GNU GPL for details.
length not align with page size, change to 0x0
Read flash from 0x60000, length 0x0
Done
Autoboot (2 seconds) in progress, press any key to stop ..
Autoboot aborted
Type "help" to get a list of commands
blob>
2> 通过 tftp 下载内核到pc内存 0x80800000 地址处
blob> tftp zImage0917
Begin init ether usbnet!!!
***** Plug-in USB cable & config usbdnet now ******
exit check_usb_connection:1
TFTPing zImage0917*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OK.
received 6144 blocks (3145156 bytes)
tftp_cmd: file 'zImage0917' loaded via tftp to address 0x80800000.
3> 擦除原来的内核分区,0x100000 为分区起始地址,0x300000为分区长度
blob> nanderase -z 0x100000 0x400000
the current NAND chip does not support Block Unlocking.
Erase 0x300000 length data from flash: 0x100000
Erase flash from 0x100000, length 0x300000
........................Done
4> 烧写内存 0x80800000 开始 实际长度为 3145156 的内核数据到起始地址为 0x100000 的内核分区
blob> nandwrite -z 0x80800000 0x100000 3145156
the current NAND chip does not support Block Unlocking.
Write 0x2ffdc4 length data from RAM: 0x80800000 to flash: 0x100000
Write flash from 0x100000, length 0x2ffdc4
Erase flash from 0x100000, length 0x300000
........................Done
........................Done
5> 下载系统分区镜像文件到pc内存 0x80800000 地址处
blob> tftp system0918.img
TFTPing system0918.img*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OK.
received 113138 blocks (57925824 bytes)
tftp_cmd: file 'system0918.img' loaded via tftp to address 0x80800000.
6> 擦除原来的flash系统分区
blob> nanderase -z 0x500000 0x4000000
the current NAND chip does not support Block Unlocking.
Erase 0x3e0f800 length data from flash: 0x400000
Erase flash from 0x400000, length 0x3e0f800
...................................................................................
...................................................................................
...................................................................................
..........................Done
7> 烧写数据到flash系统分区
blob> nandwrite -y 0x80800000 0x500000 57925824
the current NAND chip does not support Block Unlocking.
Write 0x373e0c0 length data from RAM: 0x80800000 to flash: 0x400000
Write flash from 0x400000, length 0x3591800
Erase flash from 0x400000, length 0x3591800
....................................................................................
.....................................................................................
................................................................................Done
....................................................................................
....................................................................................
................................................................Done
8> 下载数据分区镜像文件到pc内存 0x80800000 地址处
blob> tftp data0918.img
TFTPing data0918.img*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OK.
received 33992 blocks (17402880 bytes)
tftp_cmd: file 'data0918.img' loaded via tftp to address 0x80800000.
blob>
9> 擦除原来的flash数据分区
blob> nanderase -z 0x4500000 0xBB00000
the current NAND chip does not support Block Unlocking.
Erase 0xa81f000 length data from flash: 0x4400000
Erase flash from 0x4400000, length 0xa81f000
.....................................................................................
.....................................................................................
.....................................................................................
.....................................................................................
...................................................Done
10> 烧写数据镜像到flash数据分区
blob> nandwrite -y 0x80800000 0x4500000 17402880
the current NAND chip does not support Block Unlocking.
Write 0x1098c00 length data from RAM: 0x80800000 to flash: 0x4400000
Write flash from 0x4400000, length 0x1018000
Erase flash from 0x4400000, length 0x1018000
..................................................................................Done
..................................................................................Done
blob>
flash分区图:
*******************************************
*        *          *         *           *
*  blob  *  kernel  *  system *    data   *
*        *          *         *           *
*******************************************
nanderase -z 0x100000 0x400000
tftp zImage
nandwrite -z 0x80800000 0x100000
烧写system.img:
nanderase -z 0x500000 0x4000000
tftp system.img
nandwrite -y 0x80800000 0x500000
烧写 userdata.img :
nanderase -z 0x4500000 0xBB00000
tftp userdata.img
nandwrite -y 0x80800000 0x4500000
========================

第一章 建立ANDROID应用开发环境 - 5 - 1.1 步骤一:下载并安装JDK (JAVA SE DEVELOPMENT KIT) - 5 - 1.2 步骤二:下载并安装ADT集成开发环境ANDROID SDK - 6 - 1.2.1 下载Android SDK (API 17) - 7 - 1.2.2 启动ADT集成开发环境 (Android Developer Tools) - 8 - 1.3 步骤三:创建ANDROID模拟器 - 9 - 1.4 步骤四:开发第一个ANDROID程序 (验证开发环境是否搭建成功) - 11 - 1.4.1 创建HelloWorld工程 - 11 - 1.4.2 在模拟器运行Android程序 - 13 - 1.5 步骤五:建立TINY4412调试环境 - 13 - 1.5.1 安装USB ADB驱动程序 - 13 - 1.5.2 在Tiny4412上测试ADB功能 - 14 - 1.5.3 通过USB ADB在Tiny4412上运行程序 - 16 - 1.5.4 在Tiny4412上调试Android程序 - 18 - 第二章 在ANDORID程序中访问硬件 - 20 - 2.1 如何使用函数库(LIBFRIENDLYARM-HARDWARE.SO)? - 20 - 2.2 函数库(LIBFRIENDLYARM-HARDWARE.SO)接口说明 - 22 - 2.2.1 通用的输入输出接口 - 22 - 2.2.2 串口通讯的接口说明 - 23 - 2.2.3 开关LED的接口说明 - 24 - 2.2.4 让PWM蜂鸣器发声和停止发声的接口说明 - 24 - 2.2.5 读取ADC的转换结果的接口说明 - 24 - 2.2.6 I2C接口说明 - 25 - 2.2.7 SPI接口说明 - 26 - 2.2.8 GPIO接口说明 - 28 - 2.3 示例程序说明 - 29 - 2.3.1 在板LED示例 - 29 - 2.3.2 GPIO示例 - 30 - 2.3.3 串口通讯示例 - 34 - 2.3.4 PWM示例 - 35 - 2.3.5 A/D转换示例 - 36 - 2.3.6 I2C& EEPROM示例 - 36 - 2.3.7 SPI示例 - 37 - 2.4 在ADT中导入示例工程 - 37 -
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值