xlanchenustc edu cn http staff ustc edu cnxlanchen
- Slides: 130
嵌入式操作系统 陈香兰 xlanchen@ustc. edu. cn http: //staff. ustc. edu. cn/~xlanchen Spring 2007 中国科学技术大学计算机系 xlanchen@2007. 6. 4 Embedded Operating Systems
上周一 l Sky. Eye介绍 l l l Sky. Eye简介 Sky. Eye的安装和使用 u. Clinux简介 xlanchen@2007. 6. 4 Embedded Operating Systems 2
上周二 l 介绍了嵌入式系统的 Boot Loader,包括: l l l Boot Loader 的概念 Boot Loader 的主要任务 Boot Loader 的框架结构 Boot Loader 的安装 部分开源的boot loader xlanchen@2007. 6. 4 Embedded Operating Systems 3
本次课的主要内容 l 嵌入式Linux开发技术 xlanchen@2007. 6. 4 Embedded Operating Systems 4
嵌入式Linux开发技术 xlanchen@2007. 6. 3 xlanchen@2007. 6. 4 Embedded Operating Systems
(3)Windows 作站 l l l 许多开发者比较习惯Windows平台,并希望在 Windows平台上开发嵌入式Linux系统 Cygwin: 可在Windows平台上建立跨平台开发 具链 VMWare: 可在虚拟环境中执行Linux,并在Linux上进行嵌入 式Linux的开发 xlanchen@2007. 6. 4 Embedded Operating Systems 11
xlanchen@2007. 6. 4 Embedded Operating Systems 16
3、Init进程 l 启动各种应用程序(根据设置) xlanchen@2007. 6. 4 Embedded Operating Systems 32
主要内容 一、嵌入式Linux开发综述 二、Linux的配置和编译 三、根文件系统及其制作 xlanchen@2007. 6. 4 Embedded Operating Systems 37
Linux的配置和编译步骤 l Linux内核从配置到安装大致有如下步骤: l l l 清理:make mrproper 配置:make config/menuconfig/xconfig 建立依赖关系:make dep 编译:make或make z. Image 安装:make install 但在嵌入式系统开发中,并不总是按照上述步 骤 xlanchen@2007. 6. 4 Embedded Operating Systems 41
1、Linux内核选择 l l 尽管http: //www. kernel. org是主要的内核来源, 但这里可用的内核版本并不总适用于嵌入式系统 下面列出了针对当前主要嵌入式系统的Linux内 核源代码下载地点,通常直接提供了针对某种目 标硬件系统的Linux内核版本 xlanchen@2007. 6. 4 处理器系统 合适的内核站点 x 86 http: //www. kernel. org ARM http: //www. arm. linux. org. uk Power. PC http: //penguinppc. org MIPS http: //www. linux-mips. org M 68 K http: //linux-m 68 k. org Embedded Operating Systems non. MMU的CPUs http: //www. uclinux. org 42
准备ARM Linux l 下载标准Linux 的内核源码和ARM Linux,其 中ARM Linux 是基于标准Linux内核为ARM 做 的补丁 l l 标准Linux的内核源代码 ftp: //ftp. kernel. org linux-2. 4. 18. tar. bz 2 ARM Linux的补丁 ftp: //ftp. arm. linux. org. uk/pub/armlinux patch-2. 4. 18 -rmk 7. bz 2 xlanchen@2007. 6. 4 Embedded Operating Systems 46
l 解压缩Linux-2. 4. 18, l 解压缩补丁,并对linux-2. 4. 18打补丁 l 建立armlinux-2. 4. 18,将linux目录拷贝到该目 录下 xlanchen@2007. 6. 4 Embedded Operating Systems 47
建立交叉编译环境 l l l 下载交叉编译 具 ftp: //ftp. arm. linux. org. uk/pub/armlinux/toolchain cross-2. 95. 3. tar. bz 2 解压缩到/usr/local/arm目录下 tar –jxf cross-2. 95. 3. tar. bz 2 设置执行路径,在. bashrc中添加 然后,退出控制台,重新启动控制台 xlanchen@2007. 6. 4 Embedded Operating Systems 48
l 检查是否建立好交叉编译环境 l l 对arm-linux使用tab键功能 命令:arm-linux-gcc –v xlanchen@2007. 6. 4 Embedded Operating Systems 49
配置和编译arm linux l 修改Makefile中 l 目标板体系结构 l 交叉编译器 xlanchen@2007. 6. 4 Embedded Operating Systems 50
我们考虑在skyeye上模拟ep 7312 l l 下载armlinux 4 skyeye 解压缩 xlanchen@2007. 6. 4 Embedded Operating Systems 51
l 进入armlinux 4 skyeye l installguide. txt xlanchen@2007. 6. 4 Embedded Operating Systems 52
l 为Skyeye模拟的ep 7312进行如下修改: 1. linux-2. 4. x/drivers/char/Makefile, 增加 obj-$(CONFIG_LCD) += lcd_drv. o obj-$(CONFIG_TOUCH_SCREEN) += skyeye_ts_drv. o linux-2. 4. x/drivers/char/Config. in, 增加 tristate 'Sky. Eye LCD support(for EP 7312)' CONFIG_LCD tristate 'Sky. Eye Touch Screen support(for EP 7312)' CONFIG_TOUCH_SCREEN 2. 3. 增加lcd_drv. [ch], lcd_struct. h, skyeye_ts_drv. [ch], ep 7312_sys. h files 到 linux/drivers/char/目录中 xlanchen@2007. 6. 4 Embedded Operating Systems 53
l 清除,命令: l l l make mrproper make clean 配置,命令 l make xconfig 在System Type中选择CLPS 711 X/EP 721 X和CLEP 7312 在File System中,确保 l /proc file system support l ROM file system support l Second extended fs support xlanchen@2007. 6. 4 Embedded Operating Systems 54
在Block Devices选择 l l RAM disk support Initial RAM disk (initrd) support 在Character devices选择 l l l Sky. Eye LCD support(for EP 7312) Sky. Eye Touch Screen support(for EP 7312) 建立依赖关系并编译,命令 l make dep; make xlanchen@2007. 6. 4 Embedded Operating Systems 55
l 检查是否存在编译好的ARM Linux内核 xlanchen@2007. 6. 4 Embedded Operating Systems 56
主要内容 一、嵌入式Linux开发综述 二、Linux的配置和编译 三、根文件系统及其制作 xlanchen@2007. 6. 4 Embedded Operating Systems 57
l 根文件系统中的内容由FHS(Filesystem Hierarchy Standard,文件系统层次标准) 制 定 l 制定该标准的组织为FHSG(FHS Group, http: //www. pathname. com/fhs/) xlanchen@2007. 6. 4 Embedded Operating Systems 60
xlanchen@2007. 6. 4 Embedded Operating Systems 63
为目标系统准备链接库 1、glibc 2、u. Clibc xlanchen@2007. 6. 4 Embedded Operating Systems 68
glibc l l glibc套件包含若干链接库。主要包含 4种类型 的文件 实际的共享链接库,文件名为 lib. LIBRARY_NAME-GLIBC_VERSION. so, 例如glibc 2. 5的数学链接库为libm-2. 5. so xlanchen@2007. 6. 4 Embedded Operating Systems 69
l 主修订版本的符号链接,文件名为 lib. LIBRARY_NAME. so. MAJOR_REVISION_VE RSION l 例如实际的数学链接库libm-2. 5. so, 其符号连接的名称为libm. so. 6 xlanchen@2007. 6. 4 Embedded Operating Systems 70
l 静态链接库包文件, 文件名格式为 lib. LIBRARY_NAME. a, 如动态装载库libdl的静 态包文件就是libdl. a xlanchen@2007. 6. 4 Embedded Operating Systems 72
l 动态链接器的符号链接 l 对于i 386、arm或m 68 k,通常为 ld-linux. so. MAJOR_REVISION_VERSION l 对于MIPS或PPC,则通常为 ld. so. MAJOR_REVISION_VERSION xlanchen@2007. 6. 4 Embedded Operating Systems 75
u. Clibc l u. Clibc是glibc的替代品,实现了部分必要的链 接库。 网站:http: //www. uclibc. org/ l 若下载的是源代码,则 l l l make clean make config make CROSS=arm-linuxmake PREFIX=<根文件系统目录> install 若下载的是已经编译好的,则需要将库文件拷贝到 根文件系统目录下的lib目录中 xlanchen@2007. 6. 4 Embedded Operating Systems 77
xlanchen@2007. 6. 4 Embedded Operating Systems 82
l 此外,/dev目录下还包含若干必要的符号链接, 如 l l fd /proc/self/fd stdin fd/0 stdout fd/1 stderr fd/2 xlanchen@2007. 6. 4 Embedded Operating Systems 83
建立符号链接 xlanchen@2007. 6. 4 Embedded Operating Systems 84
l l 可以看一下,虚拟机中Linux主机上的 dev目录 下图为用过的romfs的dev目录 xlanchen@2007. 6. 4 Embedded Operating Systems 85
查看rootfs下的各个bin目录 xlanchen@2007. 6. 4 Embedded Operating Systems 89
Tiny. Login 网站:http: //tinylogin. busybox. net/ 下载:http: //tinylogin. busybox. net/downloads/ l Tiny. Login将许多登录 具放在单个二进制文 件中,通常会与Busy. Box并用,两者由相同的 开发者维护 l Tiny. Login中的大多数命令要使用root权限执行 xlanchen@2007. 6. 4 Embedded Operating Systems 90
例 l l 下载tinylogin-1. 2 解压缩,然后配置 使用glibc或者uclibc的交叉编译器对其进行编 译,例如 在root权限下将tinylogin-1. 2安装到根文件系统 目录中 xlanchen@2007. 6. 4 Embedded Operating Systems 91
xlanchen@2007. 6. 4 Embedded Operating Systems 92
xlanchen@2007. 6. 4 Embedded Operating Systems 93
Embutils 网站:http: //www. fefe. de/embutils/ l 这是针对主流Unix命令提供的一组经过简化和 优化的替代品。目前支持ARM、i 386、PPC和 MIPS l 其维护者与diet libc相同,只能静态链接diet libc xlanchen@2007. 6. 4 Embedded Operating Systems 94
标准的system V 初始化 l l 标准的init包在多数Linux发行版本中都能找到, 也可以在 ftp: //ftp. cistron. nl/pub/people/miquels/sysvinit/ 上找到,目前由Miquel van Soorenburg维护 包含的命令有: l halt,init,killall 5,last,mesg,runlevel, shutdown,sulogin,utmpdump,以及wall xlanchen@2007. 6. 4 Embedded Operating Systems 99
Busy. Box初始化 l l Busy. Box也提供类似init的功能,适合用于嵌入 式系统 Busy. Box不提供runlevel功能 在我们前面安装的Busy. Box中,sbin/init是 /bin/busybox的符号链接,因此Busy. Box是系 统启动后运行的第一个应用程序 Busy. Box将调用它的init xlanchen@2007. 6. 4 Embedded Operating Systems 104
Busy. Box的init l Init主要执行下列任务 1、初始化init的信号处理函数 2、初始化console控制台 3、解释/etc/inittab文件 4、运行系统初始化脚本,Busy. Box缺省使用 /etc/init. d/rc. S 5、运行所有inittab的阻塞式命令 6、运行所有inittab中的一次性执行命令 xlanchen@2007. 6. 4 Embedded Operating Systems 105
l l 在初始化完console之后,busybox将会检查是 否存在etc/inittab,如果没有将会使用缺省的 inittab配置 缺省的inittab设置,如 l l 系统重启,系统停止,init重启 还有,在最先的4个虚拟console:tty 1~tty 4上启动 shell xlanchen@2007. 6. 4 Embedded Operating Systems 107
Inittab文件的格式 l Inittab文件中每一行有下列格式 id: runlevel: action: process l 在busybox中, l l id代表tty的序号 忽略runlevel Process说明要运行的程序的路径和命令选项 Action说明process的执行方式 xlanchen@2007. 6. 4 Embedded Operating Systems 108
l 一个可能的inittab如下 (id和runlevel都为空) : : sysinit: /etc/init. d/rc. S 设置/etc/init. d/rc. S作为系统初始化文件 : : respawn: /sbin/getty 115200 tty. S 0 : : respawn: /control-module/bin/init 在串口( 115200波特率)启动一个登录会话 : : restart: /sbin/init启动控制模块定制的系统初始化脚本 设置/sbin/init为重启时运行的命令 : : shutdown: /bin/umount -a -r 系统关闭时,运行umount xlanchen@2007. 6. 4 Embedded Operating Systems 110
举例 #!/bin/sh # Remount the root filesystem in read-write (requires /etc/fstab) mount -n -o remount, rw / # Mount /proc filesystem mount /proc # Start the network interface /sbin/ifconfig eth 0 192. 168. 172. 10 xlanchen@2007. 6. 4 Embedded Operating Systems 112
/etc/fstab举例 # /etc/fstab # device directory type options # /dev/nfs / nfs defaults none /proc defaults xlanchen@2007. 6. 4 Embedded Operating Systems 113
l 看一下skyeye中 ep 7312/ep 7312_with_imagekernel下的 initrd. img中有些什么 xlanchen@2007. 6. 4 Embedded Operating Systems 122
相当于将initrd. img这个磁盘 进行文件系统格式化 xlanchen@2007. 6. 4 Embedded Operating Systems 125
l 接下来,就可以将initrd. img挂载到刚刚建立的 mount点上 l 当然,此时文件系统中基本上是空的 xlanchen@2007. 6. 4 Embedded Operating Systems 126
l 最后形成经压缩的RAM disk -9表示最高级的压缩算法 xlanchen@2007. 6. 4 Embedded Operating Systems 128
- Mail.ustc.edu.n
- Lunc and ustc
- Dong liu ustc
- Dong liu ustc
- Dong liu ustc
- Ustc repeg
- Ustc search
- Http //mbs.meb.gov.tr/ http //www.alantercihleri.com
- Siat.ung.ac.id
- Http://www-bcf.usc.edu/~gareth/isl/advertising.csv
- Dendro.cnre.vt.edu photosynthesis chloroplast
- Https://scratch.mit,edu/
- Http://weather.uwyo.edu/upperair/sounding.html
- Http://learn.genetics.utah.edu/
- 2learner
- Htts://scratch.mit.edu
- Http://www.colorado.edu/physics/phet
- Http://numericalmethods.eng.usf.edu
- Http://www.assessform.edu.au
- Dogma of biology
- Image source:http://graphicdesign.spokanefalls.edu
- Http://teachertech.rice.edu/participants/louviere/newton/
- Http://weather.uwyo.edu/upperair/sounding.html
- Http://www.exploratorium.edu/ronh/weight/
- Http://numericalmethods.eng.usf.edu
- Http.//scratch.mit.edu/
- Http corpus byu edu coca
- Optics topics
- Http://teachertech.rice.edu/participants/louviere/newton/
- Assessform locked down browser
- Http://scratch.mit.edu
- Http://dlib.nyu.edu/aco/
- " title="" />
- Http://learn.genetics.utah.edu/content/addiction/
- Http://www.openclass.chc.edu.tw
- Scratch animate your name
- Http://evolution.berkeley.edu
- ้https //scratch.mit.edu
- Parabolic partial differential equation
- Http sinhvien hufi vn
- Https://scratch.mit.edu/
- Single slit envelope
- Http://learn.genetics.utah.edu/content/addiction/
- Edu.sharif.edu
- Ksk college beed
- Junior staff mentoring
- Comberton village college staff
- Rmit staff ess
- The bass and treble staffs connected by a brace
- Mmu staff directory icems
- Playwright
- Ripe ncc staff
- Knutsford academy staff
- Haywood academy staff
- South dade middle
- Marriotts ridge bell schedule
- Bankakademie
- Wood badge staff positions
- Trauma-informed care activities for staff
- Ics command and general staff
- What is a line authority
- Eco postal staff college
- Rasic chart
- Connecting colorado staff
- What do cqc ask staff
- Fresno housing authority staff
- Ics command and general staff
- Hse efunds
- Florida association of medical staff services
- Rodes harlin hall
- Edinburgh orb
- Dual credit yrdsb
- Knutsford primary academy
- Twu financial aid
- What is a code lavender
- Define hospital and hospital pharmacy
- Robinson isd staff tools
- Smsa staff
- Library support staff certification
- Dallas arboretum
- Staff augmentation synonym
- Caistor yarborough academy
- Staff formation
- National staff development council
- Staff capacity building plan
- Staff credential
- Objectives of voluntary health agencies
- Ouhsc staff senate
- The structure of congress lesson quiz 5-2
- Pa safety committee requirements
- Darvel primary school glow
- Levelling
- Staff parish relations committee
- Trade show booth staff training
- Grand blanc high school staff
- Ics command and general staff
- Hoc method in survey
- Autoridad de linea y staff
- Phc staff list
- Miami-dade county parks and recreation staff
- George's marvellous medicine story
- Manor new tech high school
- Kandyce salik
- Sanford middle school staff
- Note names on the staff
- Drawing and disbursing
- Tugas guru kantin
- Phc staff pattern
- Staffing pattern of anganwadi
- Patricia nemeth united nations
- Maywood middle school staff
- Staff management tips
- First 90 days as chief of staff
- Proses staffing
- Training design example
- Ashbrook ward lynfield mount
- Staff allocation chart
- Wilder foundation staff
- Meteorological services mauritius
- Central transportation planning staff
- Code pink hospital
- Everton school belfast
- Lnhs staff
- Golf staff
- Pentagrama enumerado
- Elk ridge middle school
- Staff leasing forum
- Contratto staff leasing randstad
- Adventurer staff uniform
- Library development plan sample-philippines
- Staff tecnocratico