文件名称:ARM-Linux系统移植
文件大小:1.07MB
文件格式:PDF
更新时间:2015-07-28 09:17:07
系统移植
第一部分 前言....................................................................................................................................8
1 硬件环境......................................................................................................................................8
1.1主机硬件环境.......................................................................................................................8
1.2 目标板硬件环境...................................................................................................................8
1.3工具介绍...............................................................................................................................8
2软件环境.......................................................................................................................................8
2.1主机软件环境.......................................................................................................................8
2.1.1 Windows 操作系统.......................................................................................................8
2.1.2 Linux操作系统 .......................................................................................................8
2.1.3 目标板最后运行的环境...............................................................................................9
2.2 Linux下工作用户及环境....................................................................................................9
2.2.1 交叉工具的安装...........................................................................................................9
2.2.2 uboot移植工作目录....................................................................................................9
2.2.3 内核及应用程序移植工作...........................................................................................9
2.3 配置系统服务.....................................................................................................................10
2.3.1 tftp服务器的配置.......................................................................................................10
2.4 工具使用.............................................................................................................................12
2.4.1 minicom的使用..........................................................................................................12
3 作者介绍....................................................................................................................................13
3.1 策划, 组织, 指导, 发布者...................................................................................................13
3.2 ADS bootloader部分..........................................................................................................13
3.3 交叉工具部分.....................................................................................................................13
3.4 uboot部分...........................................................................................................................13
3.5 内核部分.............................................................................................................................13
3.6 应用程序部分.....................................................................................................................13
3.7 网卡驱动部分.....................................................................................................................13
3.8 Nand Flash 驱动部分.........................................................................................................13
第二部分 系统启动bootloader的编写(ADS).................................................................................141 工具介绍....................................................................................................................................14
1.1 ADS 命令行命令介绍........................................................................................................14
1.1.1 armasm........................................................................................................................14
1.1.2 armcc, armcpp.............................................................................................................14
1.1.3 armlink.........................................................................................................................14
2 基本原理....................................................................................................................................15
2.1 可执行文件组成及内存映射.............................................................................................15
2.1.1 可执行文件的组成.....................................................................................................15
2.1.2 装载过程.....................................................................................................................162.1.3 启动过程的汇编部分.................................................................................................17
2.1.4 启动过程的C部分.....................................................................................................17
3 AXD的使用以及源代码说明...................................................................................................18
3.1 源代码说明.........................................................................................................................18
3.1.1 汇编源代码说明.........................................................................................................18
3.1.2 C语言源代码说明......................................................................................................23
3.1.3 源代码下载.................................................................................................................23
3.2 AXD的使用.......................................................................................................................23
3.2.1 配置仿真器.................................................................................................................23
3.2.2 启动AXD 配置开发板...............................................................................................23
第三部分 GNU交叉工具链.............................................................................................................25
1 设置环境变量,准备源码及相关补丁...................................................................................25
1.1 设置环境变量.....................................................................................................................25
1. 2 准备源码包............................................................................................................................25
1.2.1 binuils..........................................................................................................................25
1.2.2 gcc...............................................................................................................................25
1.2.3 glibc.............................................................................................................................25
1.2.4 linux kernel..................................................................................................................26
1.3 准备补丁.............................................................................................................................26
1.3.1 ioperm.c.diff................................................................................................................26
1.3.2 flow.c.diff....................................................................................................................26
1.3.3 tlinux.diff....................................................................................................................26
1.4 编译 GNU binutils...........................................................................................................26
1.5 准备内核头文件.................................................................................................................26
1.5.1 使用当前平台的gcc编译内核头文件......................................................................26
1.5.2 复制内核头文件.........................................................................................................27
1.6 译编glibc头文件.............................................................................................................27
1.7 编译gcc第一阶段............................................................................................................27
1.8 编译完整的glibc..............................................................................................................27
1.9 编译完整的gcc.................................................................................................................28
2 GNU交叉工具链的下载...........................................................................................................28
2.1 ARM官方网站...................................................................................................................28
2.2 本文档提供的下载.............................................................................................................28
3 GNU交叉工具链的介绍与使用...............................................................................................29
3.1 常用工具介绍.....................................................................................................................29
3.2.1 armlinuxgcc的使用.................................................................................................29
3.2.2 armlinuxar 和 armlinuxranlib的使用..................................................................30
3.2.3 armlinuxobjdump的使用.........................................................................................30
3.2.4 armlinuxreadelf的使用............................................................................................31
3.2.6 armlinuxcopydump的使用......................................................................................32
4 ARM GNU常用汇编语言介绍.................................................................................................32
4.1 ARM GNU常用汇编伪指令介绍.....................................................................................32
4.2 ARM GNU专有符号.........................................................................................................33
4.3 操作码.................................................................................................................................33
5 可执行生成说明........................................................................................................................33
5.1 lds文件说明.......................................................................................................................33
5.1.1 主要符号说明.............................................................................................................33
5.1.2 段定义说明.................................................................................................................34
第四部分 uboot的移植...................................................................................................................35
1 uboot的介绍及系统结构.........................................................................................................35
1.1 uboot介绍.........................................................................................................................35
1.2 获取uboot.........................................................................................................................35
1.3 uboot体系结构.................................................................................................................35
1.3.1 uboot目录结构..........................................................................................................35
2 uboot的启动过程及工作原理...................................................................................................36
2.1 启动模式介绍.....................................................................................................................36
2.2 阶段1介绍.........................................................................................................................36
2.2.1 定义入口.....................................................................................................................36
2.2.2 设置异常向量.............................................................................................................37
2.2.3 设置CPU的模式为SVC模式..................................................................................37
2.2.4 关闭看门狗.................................................................................................................37
2.2.5 禁掉所有中断.............................................................................................................37
2.2.6 设置以CPU的频率....................................................................................................37
2.2.7 设置CP15...................................................................................................................37
2.2.8 配置内存区控制寄存器.............................................................................................38
2.2.9 安装UBOOT使的栈空间........................................................................................38
2.2.10 BSS段清0................................................................................................................38
2.2.11 搬移Nand Flash代码...............................................................................................39
2.2.12 进入C代码部分.......................................................................................................39
2.3 阶段2的C语言代码部分 .............................................................................................39
2.3.1调用一系列的初始化函数.........................................................................................39
2.3.2 初始化网络设备.........................................................................................................41
2.3.3 进入主UBOOT命令行..............................................................................................41
2.4 代码搬运.............................................................................................................................41
3 uboot的移植过程.......................................................................................................................42
3.1 环境.....................................................................................................................................42
3.2 步骤.....................................................................................................................................42
3.2.1 修改Makefile..............................................................................................................42
3.2.2 在board子目录中建立crane2410.............................................................................42
3.2.3 在include/configs/中建立配置头文件......................................................................423.2.4 指定交叉编译工具的路径.........................................................................................42
3.2.5 测试编译能否成功.....................................................................................................42
3.2.6 修改lowlevel_init.S 文件...........................................................................................43
3.2.9 UBOOT的Nand Flash移植......................................................................................45
3.2.8重新编译uboot..........................................................................................................45
3.2.9 把uboot烧入flash....................................................................................................45
4 UBOOT命令的使用................................................................................................................46
4.1 UBOOT命令的介绍.........................................................................................................46
4.1.1 获得帮助信息.............................................................................................................46
4.2 常用命令使用说明.............................................................................................................47
4.2.1 askenv(F).....................................................................................................................47
4.2.2 autoscr.........................................................................................................................47
4.2.3 base ...........................................................................................................................47
4.2.4 bdinfo...........................................................................................................................47
4.2.5 bootp............................................................................................................................47
4.2.8 tftp(tftpboot)................................................................................................................48
4.2.9 bootm...........................................................................................................................48
4.2.10 go...............................................................................................................................48
4.2.11 cmp .........................................................................................................................48
4.2.12 coninfo .....................................................................................................................48
4.2.13 cp...............................................................................................................................48
4.2.14 date............................................................................................................................49
4.2.15 erase(F)......................................................................................................................49
4.2.16 flinfo(F).....................................................................................................................49
4.2.17 iminfo........................................................................................................................49
4.2.18 loadb..........................................................................................................................49
4.2.19 md..............................................................................................................................49
4.2.20 mm ............................................................................................................................50
4.2.21 mtest .......................................................................................................................50
4.2.22 mw.............................................................................................................................50
4.2.23 nm ...........................................................................................................................50
4.2.24 printenv......................................................................................................................50
4.2.25 ping ..........................................................................................................................51
4.2.26 reset...........................................................................................................................51
4.2.27 run ...........................................................................................................................51
4.2.28 saveenv(F).................................................................................................................51
4.2.29 setenv.........................................................................................................................51
4.2.30 sleep...........................................................................................................................51
4.2.31 version.......................................................................................................................51
4.2.32 nand info....................................................................................................................51
4.2.33 nand device