Chinaunix首页 | 论坛 | 博客
  • 博客访问: 175320
  • 博文数量: 32
  • 博客积分: 1910
  • 博客等级: 上尉
  • 技术积分: 495
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-31 21:28
文章存档

2009年(3)

2008年(29)

我的朋友

分类: LINUX

2008-12-16 17:08:49

关于u-boot1.3.2的完善(脚本的使用)

1、关于脚本

      

2、制作脚本

       1)、编辑脚本文件

 [root@vm-dev u-boot-1.3.2]# cat mini2410.script

echo

echo Script Configuration:

echo ----------------------

echo set update_kernel:

setenv update_kernel 'tftp 0x30008000 uImage;nand erase 0x80000 0x200000;nand write 0x30008000 0x80000 0x200000'

echo set update_rootfs:

setenv update_rootfs 'tftp 0x30008000 root.cramfs;nand erase 0x280000 0x400000;nand write 0x30008000 0x280000 0x400000'

echo set update_boot:

setenv update_boot 'tftp 0x30008000 u-boot.bin;nand erase 0x0000 0x80000;nand write 0x30008000 0x0000 0x80000'

echo set update_usr(erase usr):

setenv update_usr 'nand erase 0x00680000 0x03980000'

saveenv

echo Done

 

[root@vm-dev u-boot-1.3.2]#

       2)、制作脚本镜像

              使用脚本来制作

              脚本如下:

 [root@vm-dev u-boot-1.3.2]# cat mkscript_mini2410.sh

#!/bin/sh

tools/mkimage -A ARM -O linux -T script -C none -a 0 -e 0 -n "autoscr example script" -d mini2410.script /tftpboot/mini2410.img

[root@vm-dev u-boot-1.3.2]#

                   运行制作镜像:

[root@vm-dev u-boot-1.3.2]# ./mkscript_mini2410.sh

Image Name:   autoscr example script

Created:      Sun Dec  8 09:56:37 2024

Image Type:   ARM Linux Script (uncompressed)

Data Size:    586 Bytes = 0.57 kB = 0.00 MB

Load Address: 0x00000000

Entry Point:  0x00000000

Contents:

   Image 0:      578 Bytes =    0 kB = 0 MB

[root@vm-dev u-boot-1.3.2]#

 

       3)、运行脚本镜像

下载u-boot的配置脚本文件

tftp 0x30008000 mini2410.img

[mini2410 #] tftp 0x30008000 mini2410.img

Found DM9000 ID:90000a46 at address 10000000 !

DM9000 work in 16 bus width

bd->bi_entaddr: 08:00:3e:26:0a:5b

[eth_init]MAC:8:0:3e:26:a:5b:

TFTP from server 192.168.1.152; our IP address is 192.168.1.155

Filename 'mini2410.img'.

Load address: 0x30008000

Loading: T #

done

Bytes transferred = 650 (28a hex)

[mini2410 #]

       执行配置脚本,使用u-bootautoscr命令

[mini2410 #] autoscr 0x30008000

## Executing script at 30008000

 

Script Configuration:

----------------------

set update_kernel:

set update_rootfs:

set update_boot:

set update_usr(erase usr):

Saving Environment to NAND...

Erasing Nand...Writing to Nand... done

Done

[mini2410 #]

       设置之后,我们可以查看u-boot的环境变量中已经添加了新的变量

[mini2410 #] printenv

bootargs=root=/dev/mtdblock2 noinitrd console=ttySAC0,115200

bootcmd=nand read 0x30008000 0x80000 0x200000;bootm

bootdelay=5

baudrate=115200

ethaddr=08:00:3e:26:0a:5b

bootfile="uImage"

stdin=serial

stdout=serial

stderr=serial

filesize=28A

fileaddr=30008000

netmask=255.255.255.0

serverip=192.168.1.152

ipaddr=192.168.1.155

update_kernel=tftp 0x30008000 uImage;nand erase 0x80000 0x200000;nand write 0x30008000 0x80000 0x200000

update_rootfs=tftp 0x30008000 root.cramfs;nand erase 0x280000 0x400000;nand write 0x30008000 0x280000 0x400000

update_boot=tftp 0x30008000 u-boot.bin;nand erase 0x0000 0x80000;nand write 0x30008000 0x0000 0x80000

update_usr=nand erase 0x00680000 0x03980000

 

Environment size: 684/16380 bytes

[mini2410 #]

       这时,我们的u-boot的配置就结束了。现在除了你要修改ip地址之外,就不需要再更改其它的配置了。

3、使用脚本

1、  烧写内核

在配置好u-boot之后,执行烧写内核的命令。

[mini2410 #] run update_kernel

Found DM9000 ID:90000a46 at address 10000000 !

DM9000 work in 16 bus width

bd->bi_entaddr: 08:00:3e:26:0a:5b

[eth_init]MAC:8:0:3e:26:a:5b:

TFTP from server 192.168.1.152; our IP address is 192.168.1.155

Filename 'uImage'.

Load address: 0x30008000

Loading: T #################################################################

         ###########################################################

done

Bytes transferred = 1814116 (1bae64 hex)

 

NAND erase: device 0 offset 0x80000, size 0x200000

Erasing at 0x27c000 -- 100% complete.

OK

 

NAND write: device 0 offset 0x80000, size 0x200000

 2097152 bytes written: OK

[mini2410 #]

 

2、  烧写根文件系统

在配置好u-boot之后,执行烧写根文件系统的命令。

[mini2410 #] run update_rootfs

Found DM9000 ID:90000a46 at address 10000000 !

DM9000 work in 16 bus width

bd->bi_entaddr: 08:00:3e:26:0a:5b

[eth_init]MAC:8:0:3e:26:a:5b:

TFTP from server 192.168.1.152; our IP address is 192.168.1.155

Filename 'root.cramfs'.

Load address: 0x30008000

Loading: T #################################################################

         #################################################################

         ########################

done

Bytes transferred = 2248704 (225000 hex)

 

NAND erase: device 0 offset 0x280000, size 0x400000

Erasing at 0x67c000 -- 100% complete.

OK

 

NAND write: device 0 offset 0x280000, size 0x400000

 4194304 bytes written: OK

[mini2410 #]

3、  擦除usr分区

在配置好根文件系统之后,一般情况下是不会用到这个命令的。只有当我们的usr分区出现了坏块,才会需要去擦除usr分区(也就是应用程序分区)。注意的是,擦除之后,整个usr分区的内容都会被删除。

4、  更新u-boot

在配置好根文件系统之后,一般情况不需要更新u-boot。你采用前面的烧写bootloader的方法也可以。注意的是烧写完之后,u-boot是需要重新进行配置的。

也可以使用如下命令:

[mini2410 #] run update_boot

Found DM9000 ID:90000a46 at address 10000000 !

DM9000 work in 16 bus width

bd->bi_entaddr: 08:00:3e:26:0a:5b

[eth_init]MAC:8:0:3e:26:a:5b:

TFTP from server 192.168.1.152; our IP address is 192.168.1.155

Filename 'u-boot.bin'.

Load address: 0x30008000

Loading: T ##########

done

Bytes transferred = 135448 (21118 hex)

 

NAND erase: device 0 offset 0x0, size 0x80000

Erasing at 0x7c000 -- 100% complete.

OK

 

NAND write: device 0 offset 0x0, size 0x80000

 524288 bytes written: OK

[mini2410 #]

 

 

2008-12-16

于北京

阅读(1710) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~