Chinaunix首页 | 论坛 | 博客
  • 博客访问: 377327
  • 博文数量: 57
  • 博客积分: 2299
  • 博客等级: 大尉
  • 技术积分: 1109
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-27 23:12
文章分类
文章存档

2011年(4)

2010年(53)

分类: 嵌入式

2010-01-22 07:32:31

昨晚按照网上大侠的方法做了让u-boot支持对yaffs2文件系统的烧写,具体方法见http://blog.chinaunix.net/u3/101649/showart_2134240.html 但是我的却没有成功,总是说init参数传的不正确,要停电了,没法,郁闷的睡去。
    今天起个大早,可以说是这学期一来最早的,好了,废话不多说,下面详细说说我是如何来确定自己引导文件系统的。
1、用jtag烧写出厂时候的u-boot到nor flash里面,见图
然后从nor flash启动,选择烧录内核,把自己的内核烧进去。注意是uImage,而不是zImage,因为现在u-boot还不支持zImage,不知道怎么改。

##### EmbedSky BIOS for SKY2440/TQ2440 #####
Press Space key to Download Mode !
                                                                                
##### Boot for Nor Flash Main Menu #####
[1] Download u-boot or STEPLDR.nb1 or other bootloader to Nand Flash
[2] Download Eboot to Nand Flash
[3] Download Linux Kernel to Nand Flash
[5] Download CRAMFS image to Nand Flash
[6] Download YAFFS image to Nand Flash
[7] Download Program (uCOS-II or TQ2440_Test) to SDRAM and Run it
[8] Boot the system
[9] Format the Nand Flash
[0] Set the boot parameters
[a] Download User Program (eg: uCOS-II or TQ2440_Test)
[b] Download LOGO Picture (.bin) to Nand Flash
[l] Set LCD Parameters
[o] Download u-boot to Nor Flash
[r] Reboot u-boot
[q] quit from menu
Enter your selection: 3
USB host is connected. Waiting a download.

接着把文件系统也烧进去
最后把自己的u-boot烧进去
2、重启开发板你将会看到

U-Boot 2009.08 ( 1�.. 22 2010 - 07:16:19)
                                                                                
DRAM: 64 MB
Flash: 2 MB
NAND: NAND_ECC_NONE selected by board driver. This is not recommended !!
256 MiB
*** Warning - bad CRC or NAND, using default environment
                                                                                
In: serial
Out: serial
Err: serial
Net: dm9000
gfy@S3C2440 #

现在有个好久都没解决的问题,saveenv时,会有这样的错误

gfy@S3C2440 # saveenv
Saving Environment to NAND...
Erasing Nand...
                                                                                
NAND 256MiB 3,3V 8-bit: MTD Erase failure: -22
                                                                                
Writing to Nand...
gfy@S3C2440 #

先不管他,设置一下bootcmd

setenv bootcmd 'nand read 0x31000000 0x200000 0x200000;bootm 0x31000000'

然后boot即可启动内核和文件系统了

gfy@S3C2440 # boot
                                                                                
NAND read: device 0 offset 0x200000, size 0x200000
 2097152 bytes read: OK
## Booting kernel from Legacy Image at 31000000 ...
   Image Name: Linux-2.6.25.8
   Created: 2010-01-21 16:05:13 UTC
   Image Type: ARM Linux Kernel Image (uncompressed)
   Data Size: 1994104 Bytes = 1.9 MB
   Load Address: 30008000
   Entry Point: 30008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK
                                                                                
Starting kernel ...
                                                                                
Uncompressing Linux.............................................................
Linux version 2.6.25.8 (root@localhost.localdomain) (gcc version 4.3.3 (Sourcer0
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=00007177
Machine: SMDK2440
Warning: bad configuration page, trying to continue
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
S3C24XX Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists in Zone order, mobility grouping off. Total pages: 4064
Kernel command line: root=/dev/mtdblock2 ro init=/bin/bash console=ttySAC0
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
PID hash table entries: 64 (order: 6, 256 bytes)
timer tcon=00500000, tcnt a4ca, tcfg 00000200,00000000, usec 00001e57
Console: colour dummy device 80x30
console [ttySAC0] enabled
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 16MB = 16MB total
Memory: 11676KB available (3672K code, 695K data, 132K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 152 bytes
NET: Registered protocol family 16
S3C2410 Power Management, (c) 2004 Simtec Electronics
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c1800000, irq 33
DMA channel 1 at c1800040, irq 34
DMA channel 2 at c1800080, irq 35
DMA channel 3 at c18000c0, irq 36
S3C244X: Clock Support, DVS off
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: 512 (order: 0, 4096 bytes)
TCP bind hash table entries: 512 (order: -1, 2048 bytes)
TCP: Hash tables configured (established 512 bind 512)
TCP reno registered
NetWinder Floating Point Emulator V0.97 (double precision)
NTFS driver 2.1.29 [Flags: R/W DEBUG].
yaffs Jan 21 2010 23:51:49 Installing.
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 40x30
fb0: s3c2410fb frame buffer device
lp: driver loaded but no devices found
ppdev: user-space parallel port driver
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
s3c2440-uart.0: tq2440_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: tq2440_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: tq2440_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
loop: module loaded
dm9000 Ethernet Driver
eth%d: Invalid ethernet MAC address. Please set using ifconfig
eth0: dm9000 at c1802000,c1804004 IRQ 51 MAC: 00:00:00:00:00:00
Linux video capture interface: v2.00
usbcore: registered new interface driver gspca
drivers/media/video/gspcav1/gspca_core.c: gspca driver 01.00.20 registered
Uniform Multi-Platform E-IDE driver
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
Driver 'sd' needs updating - please use bus_type methods
Driver 'sr' needs updating - please use bus_type methods
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=2, 19ns Twrph0=3 29ns, Twrph1=2 19ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-b)
Scanning device for bad blocks
Creating 3 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x00040000-0x10000000 : "EmbedSky_Board_uboot_T"
0x00200000-0x00400000 : "EmbedSky_Board_kernel"
ftl_cs: FTL header not found.
0x00400000-0x0ff80000 : "EmbedSky_Board_yaffs2"
ftl_cs: FTL header not found.
usbmon: debugfs is not available
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
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.
mice: PS/2 mouse device common for all mice
EmbedSky TouchScreen successfully loaded
input: EmbedSky TouchScreen as /class/input/input0
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2440-i2c s3c2440-i2c: slave address 0x10
s3c2440-i2c s3c2440-i2c: bus frequency set to 98 KHz
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
usbcore: registered new interface driver hiddev
usbcore: registered new interface driver usbhid
drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver
TCP cubic registered
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
yaffs: dev is 32505858 name is "mtdblock2"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
yaffs: auto selecting yaffs2
yaffs_read_super: isCheckpointed 0
VFS: Mounted root (yaffs filesystem) readonly.
Freeing init memory: 132K
Failed to execute /bin/bash. Attempting defaults...
mkdir: cannot create directory '/var/lock': Read-only file system
Try to bring eth0 interface up ...
                                                                                
Please press Enter to activate this console. ifconfig eth0 hw ether 0a:1b:2c:3df
eth0: link down
ifconfig eth0 192.168.1.6 netmask 255.255.255.0 up
 servfox version: 1.1.3 date: 11:12:2005 (C) mxhaard@magic.fr
ERROR opening V4L interface
BusyBox v1.13.0 (2009-11-03 00:34:02 CST) multi-call binary
                                                                                
Usage: route [{add|del|delete}]
                                                                                
Edit kernel routing tables
                                                                                
Options:
        -n Don

        -e      Display other/more information                                 
        -A inet{6}      Select address family                                  
                                                                               
add default gw 192.168.1.2                                                     
[01/Jan/1970:00:00:09 +0000] boa: server version Boa/0.94.13                   
[01/Jan/1970:00:00:09 +0000] boa: server built Nov 11 2009 at 10:52:09.        
[01/Jan/1970:00:00:09 +0000] boa: starting server pid=831, port 80             
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1  

哈哈,终于看到自己以前移植的boa服务器信息了,说明自己移植的u-boot亦能引导内核和文件系统。

但是还有点点错误,就是saveenv的时候会出现刚才那个错误,以后修改了说明方法!这个u-boot还有一个缺点是不能烧写yaffs2文件系统,待以后更新。

 
saveenv的问题解决了,修改了yy2440.h里面关于env的配置,如下,是按照天嵌包里面的来修改的

#define CONFIG_ENV_OFFSET 0x40000 //将环境变量保存到nand中的0x4000位置
#define CONFIG_ENV_SIZE        0x20000    /* Total Size of Environment Sector */

发现个问题,把CONFIG_ENV_OFFSET设为0x30000就会出现上述错误,改为0x40000就可以,此问题还得细究。
阅读(3545) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~