linux,Android基础知识总结
1.Android编译系统分析2.文件系统分析3.制作交叉工具链4.软件编译常识5.设置模块流程分析
6.linux系统启动流程分析7.linux下svn使用指南8.LFS相关
9.linux内核的初步理解
====================================================
================
android系统开发指南(常用环境的搭建和使用)说明:
有的步骤会用到脚本简化操作,脚本通过svn服务器获取:svncosvn://192.168.2.148/smartphone/td0901/release/images/scripts用户名为各位的姓名拼音,密码与用户名相同一编译android源码,制作文件系统二ubuntu下烧录内核和文件系统
一编译android源码,制作文件系统1.开发主线源码位置:
svn://192.168.2.148/smartphone/td0901/trunk/cupcake-jianping//cupcake源代码svn://192.168.2.148/smartphone/td0901/trunk/linux-2.6.28-a1//内核源代码2.打标的源代码位置
svnlistsvn://192.168.2.148/smartphone/td0901/tag
我们可以通过svnlistsvn://192.168.2.148/smartphone查看svn版本库内核更多信息请参卡以下文档:
http://192.168.2.148/svn/smartphone/
http://192.168.2.148/svn/smartphone/智能平台开发部资料管理手册V1.0.dochttp://192.168.2.148/svn/smartphone/linux下svn操作指南及规范.doc用户名为各位的姓名拼音,密码与用户名相同
3.编译源码
进入cupcake工作拷贝的顶层目录,执行:../make_image15.sh部分执行结果:
out/target/product/littleton/root/内核需要使用的initramfsout/target/product/littleton/system文件系统的系统分区out/target/product/littleton/data/文件系统数据分区4.编译内核
此处内核编译主要针对驱动组之外的同事1>设置工具链
内核的linux-2.6.28-a1/Makefile中设定了:CROSS_COMPILE?=arm-linux-所以设置PATH环境变量,保证能找到正确的工具链
假设工具链位于:/usr/local/marvell-arm-linux-4.1.1/设置为:exportPATH:=/usr/local/marvell-arm-linux-4.1.1/bin/:$PATH
2>更改编译选项(网络启动或者本机启动)内核顶层目录执行:makemenuconfigGeneralsetup--->
[*]InitialRAMfilesystemandRAMdisk(initramfs/initrd)support()Initramfssourcefile(s)(NEW)
如果需要支持网络启动反选[]InitialRAMfilesystemandRAMdisk(initramfs/initrd)support如果需要支持本地启动选中[*]InitialRAMfilesystemandRAMdisk(initramfs/initrd)support设置()Initramfssourcefile(s)(NEW)为root
拷贝cupcake编译结果out/target/product/littleton/root/到内核顶层目录3>编译
内核顶层目录执行makezImage编译好的内核:arch/arm/boot/zImage
5.搭建网络开发环境1>安装nfs服务器
sudoapt-getinstallnfs-kernel-servernfs-common
2>修改nfs服务器配置文件/etc/exports,确保有以下配置项/nfsroot/rootfs*(rw,no_root_squash,sync)
我们在内核中已经固定,手机通过网络方式启动,默认从/nfsroot/rootfs读取文件系统,修改配置项后需要重启nfs服务器:sudo/etc/init.d/nfs-kernel-serverrestart3>配置网络根文件系统
拷贝out/target/product/littleton/root/内容到/nfsroot/rootfs目录拷贝out/target/product/littleton/system内容到/nfsroot/rootfs/system修改/nfsroot/rootfs/init.rc去掉几个mount命令
为了使大家的过程,结果统一,可以使用脚本mkfs.cupcake完成
在执行mkfs.cupcake.nfs脚本前先到cupcake-jianping目录下执行:../make_env15.sh设置环境变量,
获取通过手动输入android源码的位置,让脚本来设置环境变量。
二ubuntu下烧录内核和文件系统1.硬件:手机一台
usb转串口线一根usb转网卡线一根2.软件环境
1>tftp服务器
执行脚本:setup_tftpd.sh安装和配置tftp服务器,我们默认以/tftpboot为tftp服务器的根目录,需要下载的文件都放在该目录下。
2>获取待烧录的镜像文件
svnlistsvn://192.168.2.148/smartphone/td0901/release/images查看服务器上的版本情况,通常我们下载最新的,例如,下载9月18号发布的版本:
svncosvn://192.168.2.148/smartphone/td0901/release/images/images200909183>烧录镜像文件
用以下文件为例,示范通过tftp烧写内核和文件系统内核zImage0917系统分区:system0918.img数据分区data0918.img
待烧写的以上文件必须存在于tftp服务器根目录/tftpboot下。具体步骤:
首先连接好硬件设备进入blob下载模式1>blob起来后按任意键Processingobmparameters...
Can'tdetectmicco.SetPMICasnormalI2Cmode.
NANDflash(Manu=0x98Device=0xba)detected!Slot0Found
getrelocationtable
FoundMainBadblocktableataddress0x0f000000,version0x01FoundMirrorBadblocktableataddress0x0efc0000,version0x01ConsideryourselfBLOBed!
blobversion2.0.5-pre3forMarvellLittleton
Copyright(C)19992000200120022003Jan-DerkBakkerandErikMouw
blobcomeswithABSOLUTELYNOWARRANTY;readtheGNUGPLfordetails.Thisisfreesoftware,andyouarewelcometoredistributeitundercertainconditions;readtheGNUGPLfordetails.lengthnotalignwithpagesize,changeto0x0Readflashfrom0x60000,length0x0Done
Autoboot(2seconds)inprogress,pressanykeytostop..Autobootaborted
Type\togetalistofcommandsblob>
2>通过tftp下载内核到pc内存0x80800000地址处blob>tftpzImage0917Begininitetherusbnet!!!
*****Plug-inUSBcable&configusbdnetnow******exitcheck_usb_connection:1
TFTPingzImage0917*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^OK.received6144blocks(3145156bytes)
tftp_cmd:file'zImage0917'loadedviatftptoaddress0x80800000.
3>擦除原来的内核分区,0x100000为分区起始地址,0x300000为分区长度blob>nanderase-z0x1000000x400000
thecurrentNANDchipdoesnotsupportBlockUnlocking.Erase0x300000lengthdatafromflash:0x100000Eraseflashfrom0x100000,length0x300000........................Done
4>烧写内存0x80800000开始实际长度为3145156的内核数据到起始地址为0x100000的内核分区
blob>nandwrite-z0x808000000x1000003145156
thecurrentNANDchipdoesnotsupportBlockUnlocking.
Write0x2ffdc4lengthdatafromRAM:0x80800000toflash:0x100000Writeflashfrom0x100000,length0x2ffdc4Eraseflashfrom0x100000,length0x300000........................Done........................Done
5>下载系统分区镜像文件到pc内存0x80800000地址处blob>tftpsystem0918.img
TFTPingsystem0918.img*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^OK.received113138blocks(57925824bytes)
tftp_cmd:file'system0918.img'loadedviatftptoaddress0x80800000.6>擦除原来的flash系统分区
blob>nanderase-z0x5000000x4000000
thecurrentNANDchipdoesnotsupportBlockUnlocking.Erase0x3e0f800lengthdatafromflash:0x400000Eraseflashfrom0x400000,length0x3e0f800
...................................................................................................................................................................................................................................................................................Done
7>烧写数据到flash系统分区
blob>nandwrite-y0x808000000x50000057925824
thecurrentNANDchipdoesnotsupportBlockUnlocking.
Write0x373e0c0lengthdatafromRAM:0x80800000toflash:0x400000Writeflashfrom0x400000,length0x3591800Eraseflashfrom0x400000,length0x3591800
.........................................................................................................................................................................................................................................................Done........................................................................................................................................................................................................................................Done
8>下载数据分区镜像文件到pc内存0x80800000地址处blob>tftpdata0918.img
TFTPingdata0918.img*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^OK.received33992blocks(17402880bytes)
tftp_cmd:file'data0918.img'loadedviatftptoaddress0x80800000.blob>
9>擦除原来的flash数据分区
blob>nanderase-z0x45000000xBB00000
thecurrentNANDchipdoesnotsupportBlockUnlocking.Erase0xa81f000lengthdatafromflash:0x4400000Eraseflashfrom0x4400000,length0xa81f000
.......................................................................................................................................................................................................................................................................................................................................................................................................Done
10>烧写数据镜像到flash数据分区
blob>nandwrite-y0x808000000x450000017402880thecurrentNANDchipdoesnotsupportBlockUnlocking.
Write0x1098c00lengthdatafromRAM:0x80800000toflash:0x4400000Writeflashfrom0x4400000,length0x1018000Eraseflashfrom0x4400000,length0x1018000
..................................................................................Done..................................................................................Doneblob>
flash分区图:
*************************************************blob*kernel*system*data*************************************************nanderase-z0x1000000x400000tftpzImage
nandwrite-z0x808000000x100000
nanderase-z0x5000000x4000000tftpsystem.img
nandwrite-y0x808000000x500000
nanderase-z0x45000000xBB00000tftpuserdata.img
nandwrite-y0x808000000x4500000