u-boot使用
[u-boot@MINI2440]# mmc init mmc: Probing for SDHC ... mmc: SD 2.0 or later card found trying to detect SD Card... Manufacturer: 0x00, OEM "Product name: " ", revision 0.0 Serial number: 7864775 Manufacturing date: 11/2006 CRC: 0x4f, b0 = 1 READ_BL_LEN=6, C_SIZE_MULT=7, C_SIZE=4095 size = 0 SD Card detected RCA: 0x2 type: SD mmc1 is available [u-boot@MINI2440]# fatload mmc 1 0x30008000 u-boot.bin reading u-boot.bin 256220 bytes read [u-boot@MINI2440]# nand erase 0 0x40000 NAND erase: device 0 offset 0x0, size 0x40000 Erasing at 0x2000000000004 -- 0% complete. OK [u-boot@MINI2440]# nand write 0x30008000 0 0x40000 NAND write: device 0 offset 0x0, size 0x40000 Writing at 0x2000000020000 -- 100% is complete. 262144 bytes written: OK |
[u-boot@MINI2440]# usb start (Re)start USB... USB: scanning bus for devices... 2 USB Device(s) found scanning bus for storage devices... 1 Storage Device(s) found [u-boot@MINI2440]# usb storage Device 0: Vendor: Kingston Rev: PMAP Prod: DT 101 II Type: Removable Hard Disk Capacity: 3875.0 MB = 3.7 GB (7936000 x 512) [u-boot@MINI2440]# usb part 0 print_part of 0 Partition Map for USB device 0 -- Partition Type: DOS Partition Start Sector Num Sectors Type 4 63 7935937 c [u-boot@MINI2440]# fatload usb 0:4 0x30008000 u-boot.bin reading u-boot.bin ........................ 256220 bytes read [u-boot@MINI2440]# protect off all Un-Protect Flash Bank # 1 [u-boot@MINI2440]# erase 0x0 0x3ffff Erasing sector 0 ... ok. Erasing sector 1 ... ok. Erasing sector 2 ... ok. Erasing sector 3 ... ok. Erased 4 sectors [u-boot@MINI2440]# cp.b 0x30008000 0x0 0x3ffff Copy to Flash... done |
3) 通过TFTP服务烧入Nand Flash:
[u-boot@MINI2440]# tftpboot 30008000 192.168.1.100:u-boot.bin dm9000 i/o: 0x20000300, id: 0x90000a46 DM9000: running in 16 bit mode MAC: 08:08:11:18:12:27 operating at 100M full duplex mode Using dm9000 device TFTP from server 192.168.1.100; our IP address is 192.168.1.101 Filename 'u-boot.bin'. Load address: 0x30008000 Loading: T ################## done Bytes transferred = 256220 (3e8dc hex) [u-boot@MINI2440]# nand erase 0 0x40000 NAND erase: device 0 offset 0x0, size 0x40000 Erasing at 0x2000000000004 -- 0% complete. OK [u-boot@MINI2440]# nand write 0x30008000 0 0x40000 NAND write: device 0 offset 0x0, size 0x40000 Writing at 0x2000000020000 -- 100% is complete. 262144 bytes written: OK |
4) 通过NFS 服务烧入Nand Flash:
[u-boot@MINI2440]# nfs 30008000 192.168.1.100:/home/tekkaman/development/share/u-boot.bin dm9000 i/o: 0x20000300, id: 0x90000a46 DM9000: running in 16 bit mode MAC: 08:08:11:18:12:27 operating at 100M full duplex mode Using dm9000 device File transfer via NFS from server 192.168.1.100; our IP address is 192.168.1.101 Filename '/home/tekkaman/development/share/u-boot.bin'. Load address: 0x30008000 Loading: ################################################### done Bytes transferred = 256220 (3e8dc hex) [u-boot@MINI2440]# nand erase 0 0x40000 NAND erase: device 0 offset 0x0, size 0x40000 Erasing at 0x2000000000004 -- 0% complete. OK [u-boot@MINI2440]# nand write 0x30008000 0 0x40000 NAND write: device 0 offset 0x0, size 0x40000 Writing at 0x2000000020000 -- 100% is complete. 262144 bytes written: OK |
内核引导
为什么要用U-boot的mkimage工具处理内核映像zImage? 因为在用bootm命令引导内核的时候,bootm需要读取一个64字节的文件头,来获取这个内核映象所针对的CPU体系结构、OS、加载到内存中的位置、在内存中入口点的位置以及映象名等等信息。这样bootm才能为OS设置好启动环境,并跳入内核映象的入口点。而mkimage就是添加这个文件头的专用工具。具体的实现请看U-boot中bootm的源码和mkimage的源码。 |
mkimage工具的使用: 参数说明: -A指定CPU的体系结构,可用值有:alpha、arm 、x86、ia64、mips、mips64、ppc 、s390、sh、sparc 、sparc64、m68k等 -O指定操作系统类型,可用值有:openbsd、netbsd、freebsd、4_4bsd、linux、svr4、esix、solaris、irix、sco、dell、ncr、lynxos、vxworks、psos、qnx、u-boot、rtems、artos -T指定映象类型,可用值有:standalone、kernel、ramdisk、multi、firmware、script、filesystem -C指定映象压缩方式,可用值有: none 不压缩(一般使用这个,因为zImage是已经被bzip2压缩过的自解压内核) gzip 用gzip的压缩方式 bzip2 用bzip2的压缩方式 -a指定映象在内存中的加载地址,映象下载到内存中时,要按照用mkimage制作映象时,这个参数所指定的地址值来下载 -e 指定映象运行的入口点地址,这个地址就是-a参数指定的值加上0x40(因为前面有个mkimage添加的0x40个字节的头) -n 指定映象名 -d指定制作映象的源文件 以下是制作内核映像的命令示例: mkimage -n 'tekkaman' -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008040 -d zImage zImage.img |
[u-boot@MINI2440]# mmc init mmc: Probing for SDHC ... mmc: SD 2.0 or later card found trying to detect SD Card... Manufacturer: 0x00, OEM "Product name: " ", revision 0.0 Serial number: 7864775 Manufacturing date: 11/2006 CRC: 0x4f, b0 = 1 READ_BL_LEN=6, C_SIZE_MULT=7, C_SIZE=4095 size = 0 SD Card detected RCA: 0x2 type: SD mmc1 is available [u-boot@MINI2440]# fatload mmc 1 30008000 zImage.img reading zImage.img 2277540 bytes read [u-boot@MINI2440]# bootm 30008000 ## Booting kernel from Legacy Image at 30008000 ... Image Name: tekkaman Created: 2010-03-29 12:59:51 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 2277476 Bytes = 2.2 MB Load Address: 30008000 Entry Point: 30008040 Verifying Checksum ... OK XIP Kernel Image ... OK OK Starting kernel ... Uncompressing Linux... done, booting the kernel. Linux version 2.6.33.1 (tekkaman@MAGI-Linux) (gcc version 4.3.2 (crosstool-NG-1.6.1-tekkaman) ) #5 Mon Mar 29 20:58:50 CST 2010 CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177 CPU: VIVT data cache, VIVT instruction cache Machine: MINI2440 (略) |
[u-boot@MINI2440]# tftpboot 0x30008000 192.168.1.100:zImage.img dm9000 i/o: 0x20000300, id: 0x90000a46 DM9000: running in 16 bit mode MAC: 08:08:11:18:12:27 operating at 100M full duplex mode Using dm9000 device TFTP from server 192.168.1.100; our IP address is 192.168.1.101 Filename 'zImage.img'. Load address: 0x30008000 Loading: T ################################################################# ################################################################# ########################## done Bytes transferred = 2277540 (22c0a4 hex) [u-boot@MINI2440]# bootm 30008000 ## Booting kernel from Legacy Image at 30008000 ... Image Name: tekkaman Created: 2010-03-29 12:59:51 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 2277476 Bytes = 2.2 MB Load Address: 30008000 Entry Point: 30008040 Verifying Checksum ... OK XIP Kernel Image ... OK OK Starting kernel ... Uncompressing Linux... done, booting the kernel. Linux version 2.6.33.1 (tekkaman@MAGI-Linux) (gcc version 4.3.2 (crosstool-NG-1.6.1-tekkaman) ) #5 Mon Mar 29 20:58:50 CST 2010 CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177 CPU: VIVT data cache, VIVT instruction cache Machine: MINI2440 (略) |
[u-boot@MINI2440]# nfs 30008000 192.168.1.100:/home/tekkaman/development/share/zImage.img dm9000 i/o: 0x20000300, id: 0x90000a46 DM9000: running in 16 bit mode MAC: 08:08:11:18:12:27 operating at 100M full duplex mode Using dm9000 device File transfer via NFS from server 192.168.1.100; our IP address is 192.168.1.101 Filename '/home/tekkaman/development/share/zImage.img'. Load address: 0x30008000 Loading: ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ####################################################### done Bytes transferred = 2277540 (22c0a4 hex) [u-boot@MINI2440]# bootm 30008000 ## Booting kernel from Legacy Image at 30008000 ... Image Name: tekkaman Created: 2010-03-29 12:59:51 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 2277476 Bytes = 2.2 MB Load Address: 30008000 Entry Point: 30008040 Verifying Checksum ... OK XIP Kernel Image ... OK OK Starting kernel ... Uncompressing Linux... done, booting the kernel. Linux version 2.6.33.1 (tekkaman@MAGI-Linux) (gcc version 4.3.2 (crosstool-NG-1.6.1-tekkaman) ) #5 Mon Mar 29 20:58:50 CST 2010 CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177 CPU: VIVT data cache, VIVT instruction cache Machine: MINI2440 (略) |
[u-boot@MINI2440]# nfs 30008000 192.168.1.100:/home/tekkaman/development/share/zImage.img dm9000 i/o: 0x20000300, id: 0x90000a46 DM9000: running in 16 bit mode MAC: 08:08:11:18:12:27 operating at 100M full duplex mode Using dm9000 device File transfer via NFS from server 192.168.1.100; our IP address is 192.168.1.101 Filename '/home/tekkaman/development/share/zImage.img'. Load address: 0x30008000 Loading: ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ####################################################### done Bytes transferred = 2277540 (22c0a4 hex) [u-boot@MINI2440]# nand erase 0x80000 0x300000 NAND erase: device 0 offset 0x80000, size 0x300000 Erasing at 0x36000001800000 -- 0% complete. OK [u-boot@MINI2440]# nand write 30008000 0x80000 300000 NAND write: device 0 offset 0x80000, size 0x300000 Writing at 0x36000000020000 -- 100% is complete. 3145728 bytes written: OK |
[u-boot@MINI2440]# nand read 30008000 0x80000 300000 NAND read: device 0 offset 0x80000, size 0x300000 3145728 bytes read: OK [u-boot@MINI2440]# bootm 30008000 ## Booting kernel from Legacy Image at 30008000 ... Image Name: tekkaman Created: 2010-03-29 12:59:51 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 2277476 Bytes = 2.2 MB Load Address: 30008000 Entry Point: 30008040 Verifying Checksum ... OK XIP Kernel Image ... OK OK Starting kernel ... Uncompressing Linux... done, booting the kernel. Linux version 2.6.33.1 (tekkaman@MAGI-Linux) (gcc version 4.3.2 (crosstool-NG-1.6.1-tekkaman) ) #5 Mon Mar 29 20:58:50 CST 2010 CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177 CPU: VIVT data cache, VIVT instruction cache Machine: MINI2440 (略) |
u-boot使用的更多相关文章
- 玩转spring boot——快速开始
开发环境: IED环境:Eclipse JDK版本:1.8 maven版本:3.3.9 一.创建一个spring boot的mcv web应用程序 打开Eclipse,新建Maven项目 选择quic ...
- 【微框架】之一:从零开始,轻松搞定SpringCloud微框架系列--开山篇(spring boot 小demo)
Spring顶级框架有众多,那么接下的篇幅,我将重点讲解SpringCloud微框架的实现 Spring 顶级项目,包含众多,我们重点学习一下,SpringCloud项目以及SpringBoot项目 ...
- 玩转spring boot——开篇
很久没写博客了,而这一转眼就是7年.这段时间并不是我没学习东西,而是园友们的技术提高的非常快,这反而让我不知道该写些什么.我做程序已经有十几年之久了,可以说是彻彻底底的“程序老炮”,至于技术怎么样?我 ...
- 玩转spring boot——结合redis
一.准备工作 下载redis的windows版zip包:https://github.com/MSOpenTech/redis/releases 运行redis-server.exe程序 出现黑色窗口 ...
- 玩转spring boot——AOP与表单验证
AOP在大多数的情况下的应用场景是:日志和验证.至于AOP的理论知识我就不做赘述.而AOP的通知类型有好几种,今天的例子我只选一个有代表意义的“环绕通知”来演示. 一.AOP入门 修改“pom.xml ...
- 玩转spring boot——结合JPA入门
参考官方例子:https://spring.io/guides/gs/accessing-data-jpa/ 接着上篇内容 一.小试牛刀 创建maven项目后,修改pom.xml文件 <proj ...
- 玩转spring boot——结合JPA事务
接着上篇 一.准备工作 修改pom.xml文件 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=&q ...
- 玩转spring boot——结合AngularJs和JDBC
参考官方例子:http://spring.io/guides/gs/relational-data-access/ 一.项目准备 在建立mysql数据库后新建表“t_order” ; -- ----- ...
- 玩转spring boot——结合jQuery和AngularJs
在上篇的基础上 准备工作: 修改pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=&q ...
- 玩转spring boot——MVC应用
如何快速搭建一个MCV程序? 参照spring官方例子:https://spring.io/guides/gs/serving-web-content/ 一.spring mvc结合thymeleaf ...
随机推荐
- unity3d最新面试题与参考答案汇总
1.在类的构造函数前加上static会报什么错?为什么? 构造函数格式为 public+类名,如果加上static会报错(静态构造函数不能有访问修饰符)原因:静态构造函数不允许访问修饰符,也不接受任何 ...
- MVC中的统一验证机制
using MvcApplication2.Models;using System;using System.Collections.Generic;using System.ComponentMod ...
- ios NSAssert趣谈
Apple 官网介绍 NSAssert 的定义如下: #define NSAssert(condition, desc, ...) \ do { \ __PRAGMA_PUSH_NO_EXTRA_AR ...
- ASP.NET页面生命周期总结(2)
HttpAplicationFactory获取一个HttpApplication对象: 内部:1.如果是第一次请求过来,那么就把global文件编译成一个类型.(后续请求来的,就可以直接获取这个类型) ...
- 完全备份ORACLE数据库 并在另一台电脑上恢复
由于最近有oracle的项目,需要把数据库在另外一台电脑里面配置一个一样的数据库用来测试开发用,之前是一直使用mssql,只需要附加或者还原就行,但是在oracle里面,就没有这么简单,但是也不难,操 ...
- JDBC实现往MySQL插入百万级数据
想往某个表中插入几百万条数据做下测试, 原先的想法,直接写个循环10W次随便插入点数据试试吧,好吧,我真的很天真.... DROP PROCEDURE IF EXISTS proc_initData; ...
- Java 编译解释
JDK提供的主要开发工具有:编译程序,解释执行程序.调试程序.Applet执行程序.文档管理程序.包管理程序等. 1.编译程序:javac.exe,对应的javac命令将Java源程序转换为字节码. ...
- nvmw install 失败. 需修改"Msxml2.XMLHTTP"为"Msxml2.ServerXMLHTTP"
准备在windows下学习nodejs. 下载了nvmw . 但没法安装node的任何版本. 都是报错如下: C:\Users\WXG>nvmw install v0.12.0 x86 Star ...
- Top命令查看内存
c 切换显示命令名称和完整命令行. M 根据驻留内存大小进行排序 第四行:内存状态 8306544k total — 物理内存总量(8GB) 7775876k used — 使用中的内存总量(7.7G ...
- CentOs install oracle instant client
rpm -ivh oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm rpm -ivh oracle-instantclient11.2-de ...