您的位置:首页 > 其它

UBOOT操作指令例子

2013-08-14 17:04 309 查看
1.首先确保你当前使用的uboot支持nand write功能

tftp 0x50800000 zImage

nand erase 0x100000 0x1C0000

nand write 0x50800000 0x100000 0x1C0000 // 将sdram 0x30800000位置处的数据写到nandflash的0x40000位移处,写入大小为0x1C0000

//烧写zImage: // ok

tftp 0x30800000 zImage

nand erase 0x40000 0x1C0000

nand write 0x30800000 0x40000 0x1C0000 // 将sdram 0x30800000位置处的数据写到nandflash的0x40000位移处,写入大小为0x1C0000

//烧写uImage: // ok

tftp 0x30800000 uImage

nand erase 0x40000 0x1C0000

nand write 0x30800000 0x40000 0x1C0000 // 将sdram 0x30800000位置处的数据写到nandflash的0x40000位移处,写入大小为0x1C0000

//烧写rootfs.cramfs: // ok

tftp 0x30800000 rootfs_fs2410.cramfs // 这里下载的数据大小,就是后面的0x xxx的值

nand erase 0x200000 0x2000000

nand write 0x30800000 0x200000 0x xxx // 将sdram 0x30800000位置处的数据写到nandflash的0x200000位移处,写入大小为0x1C0000

//烧写rootfs.jffs2: // ok

tftp 0x30800000 rootfs_fs2410.jffs2 // 记得先改cmdline参数

nand erase 0x200000 0x2000000

nand write.jffs2 0x30800000 0x200000 0x xxx // 将sdram 0x30800000位置处的数据写到nandflash的0x200000位移处,写入大小为0x1C0000

[root@zht2056 /proc]#cat mtd

dev: size erasesize name

mtd0: 00100000 00020000 "Bootloader"

mtd1: 00400000 00020000 "Kernel"

mtd2: 05000000 00020000 "Rootfs"

mtd3: 0ab00000 00020000 "File System"

Creating 4 MTD partitions on "NAND 256MiB 3,3V 8-bit":

0x00000000-0x00100000 : "Bootloader"

0x00100000-0x00500000 : "Kernel"

0x00500000-0x05500000 : "Rootfs"

0x05500000-0x10000000 : "File System"

SMDK6410 # tftpboot 0x50000000 zImage

dm9000 i/o: 0x18000300, id: 0x90000a46

MAC: 00:40:5c:26:0a:5b

operating at 100M full duplex mode

TFTP from server 192.168.1.61; our IP address is 192.168.1.183

Filename 'zImage'.

Load address: 0x50000000

Loading: #################################################################

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

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

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

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

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

#####

done

Bytes transferred = 2021552 (1ed8b0 hex)

SMDK6410 # nand eare 0x100000 0x400000

Usage:

nand - NAND sub-system

SMDK6410 # nand erase 0x100000 0x400000

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

Erasing at 0x4e0000 -- 100% complete.

OK

SMDK6410 # nand write 0x50000000 0x100000 0x1ed8b0

NAND write: device 0 offset 0x100000, size 0x1ed8b0

nand_write: Attempt to write not page aligned data

0 bytes written: ERROR

SMDK6410 # nand write 0x50000000 0x100000 0x1ed8b0

NAND write: device 0 offset 0x100000, size 0x1ed8b0

nand_write: Attempt to write not page aligned data

0 bytes written: ERROR

SMDK6410 # nand write 0x50000000 0x100000 0x400000

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

4194304 bytes written: OK

SMDK6410 #

SMDK6410 # printenv

bootargs=root=/dev/mtdblock2 rootfstype=cramfs console=ttySAC0,115200

bootcmd=nand read 0xc0008000 0x100000 0x400000;bootm 0xc0008000

bootdelay=3

baudrate=115200

ethaddr=00:40:5c:26:0a:5b

netmask=255.255.255.0

gatewayip=192.168.1.1

severip=192.168.2.204

ipaddr=192.168.1.183

gateway=192.168.1.1

serverip=192.168.1.61

stdin=serial

stdout=serial

stderr=serial

SMDK6410 # nand erase 0x500000 0x5000000

NAND erase: device 0 offset 0x500000, size 0x5000000

Erasing at 0x54e0000 -- 100% complete.

OK

SMDK6410 # tftpboot 0x50000000 rootfs.cramfs

dm9000 i/o: 0x18000300, id: 0x90000a46

MAC: 00:40:5c:26:0a:5b

operating at unknown: 15 mode

TFTP from server 192.168.1.61; our IP address is 192.168.1.183

Filename 'rootfs.cramfs'.

Load address: 0x50000000

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

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

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

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

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

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

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

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

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

done

Bytes transferred = 2740224 (29d000 hex)

SMDK6410 # nand write 0x50000000 0x500000 0x29d000

NAND write: device 0 offset 0x500000, size 0x29d000

2740224 bytes written: OK

SMDK6410 #

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

SMDK6410 # nand erase 0 0x100000

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

Erasing at 0xe0000 -- 100% complete.

OK

SMDK6410 # ttfpboot 0x50000000 u-boot.bin

Unknown command 'ttfpboot' - try 'help'

SMDK6410 # tfpboot 0x50000000 u-boot.bin

Unknown command 'tfpboot' - try 'help'

SMDK6410 # tftpboot 0x50000000 u-boot.bin

dm9000 i/o: 0x18000300, id: 0x90000a46

MAC: 00:40:5c:26:0a:5b

operating at unknown: 15 mode

TFTP from server 192.168.1.61; our IP address is 192.168.1.183

Filename 'u-boot.bin'.

Load address: 0x50000000

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

done

Bytes transferred = 196608 (30000 hex)

SMDK6410 # nand write 0x50000000 0 0x30000

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

196608 bytes written: OK

SMDK6410 # reset

reset...

OK

修改为yaffs2后问题

yaffs_read_super: isCheckpointed 0

VFS: Mounted root (yaffs2 filesystem).

Freeing init memory: 152K

Warning: unable to open an initial console.

Kernel panic - not syncing: No init found. Try passing init= option to kernel.

bootargs=root=/dev/mtdblock2 rw rootfstype=yaffs2 noinitrd init=/linuxrc console=ttySAC0,115200

bootcmd=nand read 0xc0008000 0x100000 0x400000;bootm 0xc0008000

bootdelay=3

baudrate=115200

ethaddr=00:40:5c:26:0a:5b

ipaddr=192.168.1.100

serverip=192.168.1.99

gatewayip=192.168.1.1

netmask=255.255.255.0

stdin=serial

stdout=serial

stderr=serial

root=/dev/mtdblock2 rootfstype=yaffs2 init=/sbin/init console=ttySAC0,115200

root=/dev/mtdblock2 rootfstype=cramfs console=ttySAC0,115200

root=/dev/mtdblock2 rootfstype=yaffs2 console=ttySAC0,115200

======================================================================================================================!!!!!!!!!!!!!!!!!!!!!!!!!!!

U-Boot 1.1.6 (Jul 3 2012 - 17:28:49) for SMDK6410

**************************************************

** UT-S3C6410 Nand boot v1.0 **

** shenzhen ZongHengTong Information Technology **

** Http://www.szzht.com **

** Ver 1.0.1.1 **

**************************************************

************* ***** *******************

************* ***** ********************

************* ***** *********************

***** ***** ***** ****

***** **************** ****

***** **************** ****

***** ***** ***** ****

***** ***** ***** ****

***************** ***** ****

***************** ***** ****

***************** ***** ****

CPU: S3C6410@532MHz

Fclk = 532MHz, Hclk = 133MHz, Pclk = 66MHz, Serial = CLKUART (SYNC Mode)

Board: SMDK6410

DRAM: 128 MB

Flash: 0 kB

NAND: 256 MB

In: serial

Out: serial

Err: serial

Hit any key to stop autoboot: 0

NAND read: device 0 offset 0x100000, size 0x400000

4194304 bytes read: OK

Boot with zImage

Starting kernel ...

Uncompressing Linux................................................................................................................................... done, booting the kernel.

Linux version 2.6.28.6 (root@hp-desktop) (gcc version 4.2.2) #78 Fri Sep 2 10:10:27 CST 2011

CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387f

CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache

Machine: SMDK6410

Memory policy: ECC disabled, Data cache writeback

CPU S3C6410 (id 0x36410101)

S3C24XX Clocks, (c) 2004 Simtec Electronics

S3C64XX: PLL settings, A=532000000, M=532000000, E=24000000

S3C64XX: HCLKx2=266000000, HCLK=133000000, PCLK=66500000

div1: 00000555

mout_apll: source is fout_apll (1), rate is 532000000

mout_epll: source is fout_epll (1), rate is 24000000

mout_mpll: source is mpll (1), rate is 532000000

mmc_bus: source is dout_mpll (1), rate is 44333333

mmc_bus: source is dout_mpll (1), rate is 44333333

mmc_bus: source is dout_mpll (1), rate is 44333333

usb-host-bus: source is mout_epll (0), rate is 24000000

uclk1: source is dout_mpll (1), rate is 66500000

spi-bus: source is mout_epll (0), rate is 24000000

spi-bus: source is mout_epll (0), rate is 24000000

audio-bus0: source is mout_epll (0), rate is 24000000

audio-bus1: source is mout_epll (0), rate is 24000000

audio-bus2: source is mout_epll (0), rate is 24000000

irda-bus: source is mout_epll (0), rate is 24000000

s3c64xx: 15728640 bytes SDRAM reserved for fimc at 0x50559000

s3c64xx: 8388608 bytes SDRAM reserved for pp at 0x51459000

s3c64xx: 8388608 bytes SDRAM reserved for tv at 0x51c59000

s3c64xx: 6291456 bytes SDRAM reserved for mfc at 0x52459000

s3c64xx: 8388608 bytes SDRAM reserved for jpeg at 0x52a59000

s3c64xx: 8388608 bytes SDRAM reserved for cmm at 0x53259000

Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512

Kernel command line: /dev/mtdblock2 rootfstype=yaffs2 init=/sbin/init console=ttySAC0,115200

PID hash table entries: 512 (order: 9, 2048 bytes)

Console: colour dummy device 80x30

s3c24xx_serial_init_ports: initialising ports=4...

console [ttySAC0] enabled

Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)

Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)

Memory: 128MB = 128MB total

Memory: 71096KB available (3732K code, 494K data, 152K init)

SLUB: Genslabs=12, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1

Calibrating delay loop... 530.84 BogoMIPS (lpj=1327104)

Mount-cache hash table entries: 512

CPU: Testing write buffer coherency: ok

net_namespace: 508 bytes

NET: Registered protocol family 16

S3C6410: Initialising architecture

S3C DMA-pl080 Controller Driver, (c) 2006-2007 Samsung Electronics

Total 32 DMA channels will be initialized.

SCSI subsystem initialized

usbcore: registered new interface driver usbfs

usbcore: registered new interface driver hub

usbcore: registered new device driver usb

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 4096 (order: 3, 32768 bytes)

TCP bind hash table entries: 4096 (order: 4, 81920 bytes)

TCP: Hash tables configured (established 4096 bind 4096)

TCP reno registered

NET: Registered protocol family 1

NetWinder Floating Point Emulator V0.97 (double precision)

yaffs Jul 4 2011 16:42:38 Installing.

msgmni has been set to 139

alg: No test for stdrng (krng)

io scheduler noop registered

io scheduler anticipatory registered

io scheduler deadline registered

io scheduler cfq registered (default)

S3C_LCD clock got enabled :: 133.000 Mhz

LCD TYPE :: UT_LCD7A will be initialized

Window[0] - FB1: map_video_memory: clear ff000000:00177000

FB1: map_video_memory: dma=57200000 cpu=ff000000 size=00177000

Window[0] - FB2: map_video_memory: clear ff0bb800:000bb800

FB2: map_video_memory: dma=572bb800 cpu=ff0bb800 size=000bb800

Console: switching to colour frame buffer device 100x30

fb0: s3cfb frame buffer device

Window[1] - FB1: map_video_memory: clear ff177000:00177000

FB1: map_video_memory: dma=57400000 cpu=ff177000 size=00177000

Window[1] - FB2: map_video_memory: clear ff232800:000bb800

FB2: map_video_memory: dma=574bb800 cpu=ff232800 size=000bb800

fb1: s3cfb frame buffer device

Window[2] - FB1: map_video_memory: clear ff2ee000:000bb800

FB1: map_video_memory: dma=57600000 cpu=ff2ee000 size=000bb800

fb2: s3cfb frame buffer device

Window[3] - FB1: map_video_memory: clear ff3aa000:000bb800

FB1: map_video_memory: dma=57700000 cpu=ff3aa000 size=000bb800

fb3: s3cfb frame buffer device

s3c6400-uart.0: s3c2410_serial0 at MMIO 0x7f005000 (irq = 16) is a S3C6400/10

s3c6400-uart.1: s3c2410_serial1 at MMIO 0x7f005400 (irq = 20) is a S3C6400/10

s3c6400-uart.2: s3c2410_serial2 at MMIO 0x7f005800 (irq = 24) is a S3C6400/10

s3c6400-uart.3: s3c2410_serial3 at MMIO 0x7f005c00 (irq = 28) is a S3C6400/10

brd: module loaded

loop: module loaded

PPP generic driver version 2.4.2

dm9000 Ethernet Driver

dm9000: dm9000_probe, init GPIO/EINT.

dm9000: dm9000_probe2

dm9000: dm9000_probe3

eth%d: con201 Invalid ethernet MAC address. using default config, Please set using ifconfig

eth0: dm9000 at f7b00300,f7b00304 IRQ 108 MAC: 00:e0:4a:bc:15:e7

Linux video capture interface: v2.00

s3c-fimc: controller 0 registered successfully

s3c-fimc: controller 1 registered successfully

S3C6400 MFC Driver, (c) 2007 Samsung Electronics

S3C6400 MFC Driver, (c) 2007 Samsung Electronics

S3C PostProcessor Driver v3.12, (c) 2009 Samsung Electronics

S3C6410 TV encoder Driver, (c) 2008 Samsung Electronics

S3C6410 TV encoder Driver init OK.

S3C6410 TV scaler Driver, (c) 2008 Samsung Electronics

S3C6410 TV scaler Driver init OK.

S3C Rotator Driver, (c) 2008 Samsung Electronics

s3c_rotator_probe called

s3c_rotator_probe success

S3C JPEG Driver, (c) 2007 Samsung Electronics

s3c_g2d_probe called

s3c_g2d_probe Success

S3C G2D Init : Done

S3C G3D Driver, (c) 2007-2009 Samsung Electronics

s3c_g3d version : 0x1050000

S3C G3D Init : Done

S3C CMM Driver, (c) 2008 Samsung Electronics

Driver 'sd' needs updating - please use bus_type methods

S3C NAND Driver, (c) 2008 Samsung Electronics

S3C NAND Driver is using hardware ECC.

NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)

Creating 4 MTD partitions on "NAND 256MiB 3,3V 8-bit":

0x00000000-0x00100000 : "Bootloader"

0x00100000-0x00500000 : "Kernel"

0x00500000-0x05500000 : "Rootfs"

0x05500000-0x10000000 : "File System"

ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver

s3c2410-ohci s3c2410-ohci: S3C24XX OHCI

s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1

s3c2410-ohci s3c2410-ohci: irq 79, io mem 0x74300000

usb usb1: configuration #1 chosen from 1 choice

hub 1-0:1.0: USB hub found

hub 1-0:1.0: 2 ports detected

Initializing USB Mass Storage driver...

usbcore: registered new interface driver usb-storage

USB Mass Storage support registered.

s3c-udc : S3C HS USB OTG Device Driver, (c) 2008-2009 Samsung Electronics

s3c-udc : version 15 March 2009 (DMA Mode)

mice: PS/2 mouse device common for all mice

input: s3c-keypad as /class/input/input0

s3c-keypad Initialized

S3C Keypad Driver

S3C24XX RTC, (c) 2004,2006 Simtec Electronics

s3c2410_rtc: tick irq 34, alarm irq 92

s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling

s3c2410-rtc s3c2410-rtc: rtc core: registered s3c as rtc0

S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics

s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled

sdhci: Secure Digital Host Controller Interface driver

sdhci: Copyright(c) Pierre Ossman

s3c-sdhci s3c-sdhci.0: clock source 0: hsmmc (133000000 Hz)

s3c-sdhci s3c-sdhci.0: clock source 1: hsmmc (133000000 Hz)

s3c-sdhci s3c-sdhci.0: clock source 2: mmc_bus (44333333 Hz)

[SDHCI]to add external irq as a card detect signal......

[SDHCI]if (pdata->cfg_ext_cd)......

mmc0: SDHCI controller on samsung-hsmmc [s3c-sdhci.0] using ADMA

[SDHCI]request_irq......

sdhci: card inserted.

s3c-sdhci s3c-sdhci.1: clock source 0: hsmmc (133000000 Hz)

s3c-sdhci s3c-sdhci.1: clock source 1: hsmmc (133000000 Hz)

s3c-sdhci s3c-sdhci.1: clock source 2: mmc_bus (44333333 Hz)

[SDHCI]to add external irq as a card detect signal......

mmc1: SDHCI controller on samsung-hsmmc [s3c-sdhci.1] using ADMA

usbcore: registered new interface driver usbhid

usbhid: v2.6:USB HID core driver

Netfilter messages via NETLINK v0.30.

nf_conntrack version 0.5.0 (2048 buckets, 8192 max)

CONFIG_NF_CT_ACCT is deprecated and will be removed soon. Please use

nf_conntrack.acct=1 kernel paramater, acct=1 nf_conntrack module option or

sysctl net.netfilter.nf_conntrack_acct=1 to enable it.

ip_tables: (C) 2000-2006 Netfilter Core Team

arp_tables: (C) 2002 David S. Miller

TCP cubic registered

NET: Registered protocol family 17

RPC: Registered udp transport module.

RPC: Registered tcp transport module.

VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5

s3c2410-rtc s3c2410-rtc: hctosys: invalid date/time

Root-NFS: No NFS server available, giving up.

VFS: Unable to mount root fs via NFS, trying floppy.

VFS: Cannot open root device "<NULL>" or unknown-block(2,0)

Please append a correct "root=" boot option; here are the available partitions:

1f00 1024 mtdblock0 (driver?)

1f01 4096 mtdblock1 (driver?)

1f02 81920 mtdblock2 (driver?)

1f03 175104 mtdblock3 (driver?)

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

**************************************************************************************************************************

SMDK6410 # nand erase 0x500000 0x5000000

NAND erase: device 0 offset 0x500000, size 0x5000000

Erasing at 0x54e0000 -- 100% complete.

OK

SMDK6410 # tftpboot 0x50000000 rootfs.yaffs22

dm9000 i/o: 0x18000300, id: 0x90000a46

MAC: 00:40:5c:26:0a:5b

operating at unknown: 15 mode

TFTP from server 192.168.1.61; our IP address is 192.168.1.183

Filename 'rootfs.yaffs22'.

Load address: 0x50000000

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

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

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

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

###############################################checksum bad

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

###################################################checksum bad

###checksum bad

checksum bad

###########

##############################################checksum bad

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

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

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

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

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

#########################################checksum bad

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

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

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

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

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

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

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

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

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

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

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

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

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

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

####checksum bad

#######checksum bad

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

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

############checksum bad

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

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

done

Bytes transferred = 9411072 (8f9a00 hex)

SMDK6410 # nand write 0x50000000 0x500000 0x8f9a00

NAND write: device 0 offset 0x500000, size 0x8f9a00

9411072 bytes written: OK

SMDK6410 #

*************************************************************************************

用nfs烧录rootfs的时候需要先擦除nand flash,需要将rootfs文件压缩为命名为 .tgz 的后缀名称。否则用tar xvf 命令解压不了文件。会

提示以下信息:

tar: no gzip/bzip2 magic

打包根文件系统的时候需要注意,需要打包的是rootfs里面的文件,并不是连rootfs文件夹一起,否则无法加载。

本人的环境变量为:

SMDK6410 # printenv

bootcmd=nand read 0xc0008000 0x100000 0x400000;bootm 0xc0008000

bootdelay=3

baudrate=115200

ethaddr=00:40:5c:26:0a:5b

netmask=255.255.255.0

ipaddr=192.168.2.183

severip=192.168.2.204

gatewayip=192.168.2.1

serverip=192.168.2.204

bootargs=root=/dev/nfs nfsroot=192.168.2.204:/usr/nfs/rootfs/hptest/rootfs ip=192.168.2.183:192.168.2.204:192.168.2.1:255.255.255.0::eth0:off console=ttySAC0,115200

stdin=serial

stdout=serial

stderr=serial

烧录好文件系统后需要修改bootargs的环境变量值。

setenv bootargs "root=/dev/mtdblock2 rootfstype=yaffs2 console=ttySAC0,115200"

saveenv

setenv bootargs "root=/dev/nfs nfsroot=192.168.2.204:/usr/nfs/rootfs/hptest/rootfs ip=192.168.2.183:192.168.2.204:192.168.2.1:255.255.255.0::eth0:off console=ttySAC0,115200"

saveenv

setenv bootargs "root=/dev/nfs nfsroot=192.168.2.204:/usr/nfs/rootfs/hptest/myrootfs/rootfs ip=192.168.2.183:192.168.2.204:192.168.2.1:255.255.255.0::eth0:off console=ttySAC0,115200"

saveenv

setenv bootargs "root=/dev/nfs nfsroot=192.168.8.92:/home/maozt/imcpfs ip=192.168.8.236:192.168.8.92:192.168.8.1:255.255.255.0::eth0:off console=ttySAC0,115200"

自己设置nfs

setenv bootargs "root=/dev/nfs nfsroot=192.168.2.204:/usr/nfs/rootfs/hptest

ip=192.168.2.183:192.168.2.204:192.168.2.1:255.255.255.0::eth0:off console=ttySAC0,115200"

setenv bootargs "root=/dev/nfs nfsroot=192.168.2.204:/usr/nfs/rootfs/hptest/rootfs ip=192.168.2.183:192.168.2.204:192.168.2.1:255.255.255.0::eth0:off console=ttySAC0,115200"

将文件系统写到mtdblock2中的脚本

mount -t nfs -o intr,nolock,rsize=1024,wsize=1024 -o tcp 192.168.2.67:/usr/nfs /tmp/nfs

#! /bin/sh

echo "============================================="

echo "============mount to yaffs2 part ==========="

echo "============================================="

mount -t yaffs2 /dev/mtdblock2 /mnt

echo "============================================="

echo "============decompress file=================="

echo "============================================="

echo "============wait same time==================="

cd /mnt

tar zxvf $1

echo "============================================="

echo "============================================="

echo "============updated filesystem ok============"

echo "============================================="

echo "============================================="
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: