好文档 - 专业文书写作范文服务资料分享网站

Linux嵌入式系统环境搭建、内核配置、最小系统启动与设备文件分析

天下 分享 时间: 加入收藏 我要投稿 点赞

nfs - boot image via network using NFS protocol nm - memory modify (constant address) ping - send ICMP ECHO_REQUEST to network host printenv - print environment variables

protect - enable or disable FLASH write protection

rarpboot - boot image via network using RARP/TFTP protocol reset - Perform RESET of the CPU run - run commands in an environment variable

saveenv - save environment variables to persistent storage setenv - set environment variables sleep - delay execution for some time tftpboot - boot image via network using TFTP protocol version - print monitor version 2.6.3 命令使用说明

l askenv(F)

在标准输入(stdin)获得环境变量。 l autoscr

从内存(Memory)运行脚本。(注意,从下载地址开始,例如我们的开发板是从0x30008000处开始运

行).

# autoscr 0x30008000

## Executing script at 30008000 l base

打印或者设置当前指令与下载地址的地址偏移。 l bdinfo

打印开发板信息 # bdinfo

-arch_number = 0x000000C1 (CPU体系结构号) -env_t = 0x00000000 (环境变量)

-boot_params = 0x30000100 (启动引导参数) -DRAM bank = 0x00000000 (内存区)

--> start = 0x30000000 (SDRAM起始地址) --> size = 0x04000000 (SDRAM大小)

-ethaddr = 01:23:45:67:89:AB (以太网地址) -ip_addr = 192.168.1.5 (IP地址) -baudrate = 115200 bps (波特率) l bootp

通过网络使用Bootp或者TFTP协议引导境像文件。 # help bootp

bootp [loadAddress] [bootfilename] l bootelf

默认从0x30008000引导elf格式的文件(vmlinux) # help bootelf

bootelf [address] - load address of ELF image.

l bootd(=boot)

引导的默认命令,即运行U-BOOT中在“include/configs/smdk2410.h” 中设置的“bootcmd” 中

的命令。如下:

#define CONFIG_BOOTCOMMAND \在命令下做如下试验: # set bootcmd printenv # boot

bootdelay=3 baudrate=115200

ethaddr=01:23:45:67:89:ab # bootd bootdelay=3 baudrate=115200

ethaddr=01:23:45:67:89:ab l tftp(tftpboot)

即将内核镜像文件从PC中下载到SDRAM的指定地址,然后通过bootm来引导内核,前提是所用PC要安装设

置tftp服务。 下载信息:

# tftp 0x30008000 zImage

TFTP from server 10.0.0.1; our IP address is 10.0.0.110 Filename 'zImage'.

Load address: 0x30008000 Loading:

################################################################# ################################################################# ################################################# done

Bytes transferred = 913880 (df1d8 hex) l bootm

内核的入口地址开始引导内核。 # bootm 0x30008000

## Booting image at 30008000 ... Starting kernel ... Uncompressing

Linux...................................................................... done, . l go

直接跳转到可执行文件的入口地址,执行可执行文件。 # go 0x30008000

## Starting application at 0x30008000 ... l cmp

对输入的两段内存地址进行比较。

l

l

l

l

l l

# cmp 0x30008000 0x30008040 64

word at 0x30008000 (0xe321f0d3) != word at 0x30008040 (0xc022020c) Total of 0 words were the same # cmp 0x30008000 0x30008000 64 Total of 100 words were the same coninfo

打印所有控制设备和信息,例如 -List of available devices:

-serial 80000003 SIO stdin stdout stderr cp

内存拷贝,cp 源地址 目的地址 拷贝大小(字节) # help cp

cp [.b, .w, .l] source target count

ANE2410 # cp 0x30008000 0x3000f000 64 date

获得/设置/重设日期和时间 # date

Date: 2006-6-6 (Tuesday) Time: 06:06:06 erase(F)

擦除FLASH MEMORY。 # help erase erase start end

- erase FLASH from addr 'start' to addr 'end' erase start +len

- erase FLASH from addr 'start' to the end of sect w/addr 'start'+'len'-1 erase N:SF[-SL]

- erase sectors SF-SL in FLASH bank # N erase bank N

- erase FLASH bank # N erase all

- erase all FLASH banks flinfo(F)

打印Nor Flash信息。 iminfo

打印和校验内核镜像头, 内核的起始地址由CFG_LOAD_ADDR指定: #define CFG_LOAD_ADDR 0x30008000 /* default load address */ 该宏在include/configs/teach2410.h中定义. # iminfo

## Checking Image at 30008000 ... Image Name: Linux-2.6.14.1

Created: 2006-010-01 7:43:01 UTC

Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1047080 Bytes = 1022.5 kB Load Address: 30008000

l

l

l

l

l

Entry Point: 30008040 Verifying Checksum ... OK loadb

从串口下载二进制文件 # loadb

## Ready for binary (kermit) download to 0x30008000 at 115200 bps... ## Total Size = 0x00000000 = 0 Bytes ## Start Addr = 0x30008000 md

显示指定内存地址中的内容 # md 0

00000000: ea000012 e59ff014 e59ff014 e59ff014 ................ 00000010: e59ff014 e59ff014 e59ff014 e59ff014 ................

00000020: 33f80220 33f80280 33f802e0 33f80340 ..3...3...3@..3 00000030: 33f803a0 33f80400 33f80460 deadbeef ...3...3`..3.... 00000040: 33f80000 33f80000 33f9c0b4 33fa019c ...3...3...3...3 00000050: e10f0000 e3c0001f e38000d3 e129f000 ..............). 00000060: e3a00453 e3a01000 e5801000 e3e01000 S............... 00000070: e59f0444 e5801000 e59f1440 e59f0440 D.......@...@... 00000080: e5801000 e59f043c e3a01003 e5801000 ....<........... 00000090: eb000051 e24f009c e51f1060 e1500001 Q.....O.`.....P. 000000a0: 0a000007 e51f2068 e51f3068 e0432002 ....h ..h0... C. 000000b0: e0802002 e8b007f8 e8a107f8 e1500002 . ............P. 000000c0: dafffffb e51f008c e2400803 e2400080 ..........@...@. 000000d0: e240d00c e51f0094 e51f1094 e3a02000 ..@.......... .. 000000e0: e5802000 e2800004 e1500001 dafffffb . ........P..... 000000f0: eb000006 e59f13d0 e281f000 e1a00000 ................ mm

顺序显示指定地址往后的内存中的内容,可同时修改,地址自动递增。 # mm 0x30008000

30008000: e1a00000 ? fffff 30008004: e1a00000 ? eeeeee 30008008: e1a00000 ? q # md 30008000

30008000: 000fffff 00eeeeee e1a00000 e1a00000 ................ 30008010: e1a00000 e1a00000 e1a00000 e1a00000 ................ 30008020: ea000002 016f2818 00000000 000df1d8 .....(o......... 30008030: e1a07001 e3a08000 e10f2000 e3120003 .p....... ...... mtest

简单的RAM检测 # mtest

Pattern FFFFFFFD Writing... Reading... mw

向内存地址写内容

l

l

l

l l

l l

l

# md 30008000

30008000: ffffdffd ffffdffc ffffdffb ffffdffa ................ # mw 30008000 0 4 # md 30008000

30008000: 00000000 00000000 00000000 00000000 ................ nm

修改内存地址, 地址不递增 # nm 30008000

30008000: de4c457f ? 00000000 30008000: 00000000 ? 11111111 30008000: 11111111 ? printenv

打印环境变量 # printenv bootdelay=3 baudrate=115200

ethaddr=01:23:45:67:89:ab ipaddr=10.0.0.110 serverip=10.0.0.1

netmask=255.255.255.0 stdin=serial stdout=serial stderr=serial

Environment size: 153/65532 bytes ping

ping主机 # ping 10.0.0.1

host 10.0.0.1 is alive reset

复位CPU run

运行已经定义好的U-BOOT的命令 # set myenv ping 10.0.0.1 # run myenv

host 10.0.0.1 is alive saveenv(F)

保存设定的环境变量 setenv

设置环境变量

# setenv ipaddr 10.0.0.254 # printenv

ipaddr=10.0.0.254 sleep

命令延时执行时间

Linux嵌入式系统环境搭建、内核配置、最小系统启动与设备文件分析

nfs-bootimagevianetworkusingNFSprotocolnm-memorymodify(constantaddress)ping-sendICMPECHO_REQUESTtonetworkhostprintenv-printenvironmentvariablesprotect-en
推荐度:
点击下载文档文档为doc格式
95se126yqz6tzp833x1q
领取福利

微信扫码领取福利

微信扫码分享