当前位置: 技术问答>linux和unix
再问uboot下nand flash 读写问题
来源: 互联网 发布时间:2016-11-30
本文导语: 需要在uboot支持nand flash烧写我按着网上一些 uboot上增加write.yaffs2支持的文章,http://blogold.chinaunix.net/u3/101649/showart.php?id=2134240 在: nand erase 500000 2000000 nand write.yaffs 30007fc0 500000 12bcdc0 执行后,结果挂接的时候有很多Bad era...
需要在uboot支持nand flash烧写我按着网上一些 uboot上增加write.yaffs2支持的文章,http://blogold.chinaunix.net/u3/101649/showart.php?id=2134240
在:
nand erase 500000 2000000
nand write.yaffs 30007fc0 500000 12bcdc0
执行后,结果挂接的时候有很多Bad eraseblock之类的错误,找不到yaffs文件系统。
我也参考了帖子,http://topic.csdn.net/u/20100225/09/dd14d827-e92a-46ed-b4ad-c5a9f4b90a65.html,但这个似乎是只支持(512+16)的,好像要修改mkyaffs2imag.c,但具体不知道怎么改,求大侠们指点下!万分感激!
我的nand flash 是NAND FLASH: HY27UF081G2A(128M X 8b)128M的,page为(2k+64)。
附:
U-Boot 2010.06 (Apr 26 2011 - 09:57:53) for SMDK2416
CPU: S3C2416@400MHz
Fclk = 800MHz, Hclk = 133MHz, Pclk = 66MHz
Board: SMDK2416 DDR2
DRAM: 64 MiB
Flash: 0 Bytes
NAND: 128 MiB
In: serial
Out: serial
Err: serial
Net: dm9000
Hit any key to stop autoboot: 0
warning:device's name is NUll
NAND read: device 0 offset 0x100000, size 0x300000
3145728 bytes read: OK
## Booting kernel from Legacy Image at 30008000 ...
Image Name: linux-2.6.36-20110427
Created: 2011-04-27 3:29:07 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2790720 Bytes = 2.7 MiB
Load Address: 30008000
Entry Point: 30008040
Verifying Checksum ... OK
XIP Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 2.6.36 (root@heshanxingzhe) (gcc version 4.2.2) #473 Wed Apr 27 11:24:11 CST 2011
[ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] Machine: SMDK2416
[ 0.000000] Memory policy: ECC disabled, Data cache writeback
[ 0.000000] CPU S3C2416/S3C2450 (id 0x32450003)
[ 0.000000] S3C24XX Clocks, Copyright 2004 Simtec Electronics
[ 0.000000] CPU: MPLL on 800.000 MHz, cpu 400.000 MHz, mem 133.333 MHz, pclk 66.666 MHz
[ 0.000000] CPU: EPLL on 96.000 MHz, usb-bus 48.000 MHz
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
[ 0.000000] Kernel command line: root=/dev/mtdblock2 rw init=/linuxrc console=ttySAC0,115200 rootfstype=yaffs2
[ 0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] allocated 327680 bytes of page_cgroup
[ 0.000000] please try 'cgroup_disable=memory' option if you don't want memory cgroups
[ 0.000000] Memory: 64MB = 64MB total
[ 0.000000] Memory: 58388k/58388k available, 7148k reserved, 0K highmem
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
[ 0.000000] DMA : 0xffc00000 - 0xffe00000 ( 2 MB)
[ 0.000000] vmalloc : 0xc4800000 - 0xe0000000 ( 440 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xc4000000 ( 64 MB)
[ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
[ 0.000000] .init : 0xc0008000 - 0xc0030000 ( 160 kB)
[ 0.000000] .text : 0xc0030000 - 0xc0510000 (4992 kB)
[ 0.000000] .data : 0xc056a000 - 0xc05a5460 ( 238 kB)
[ 0.000000] SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU-based detection of stalled CPUs is disabled.
[ 0.000000] Verbose stalled-CPUs detection is disabled.
[ 0.000000] NR_IRQS:99
[ 0.000000] irq: clearing subpending status 00000002
[ 0.000000] Console: colour dummy device 80x30
[ 0.000000] console [ttySAC0] enabled
[ 0.015000] Calibrating delay loop... 199.06 BogoMIPS (lpj=497664)
[ 0.110000] pid_max: default: 32768 minimum: 301
[ 0.110000] Security Framework initialized
[ 0.115000] AppArmor: AppArmor initialized
[ 0.115000] Mount-cache hash table entries: 512
[ 0.125000] Initializing cgroup subsys ns
[ 0.125000] Initializing cgroup subsys cpuacct
[ 0.130000] Initializing cgroup subsys memory
[ 0.135000] Initializing cgroup subsys devices
[ 0.140000] Initializing cgroup subsys freezer
[ 0.145000] CPU: Testing write buffer coherency: ok
[ 0.155000] devtmpfs: initialized
[ 0.160000] NET: Registered protocol family 16
[ 0.170000] S3C2416: Initializing architecture
[ 0.170000] S3C2416: IRQ Support
[ 0.185000] bio: create slab at 0
[ 0.195000] cfg80211: Calling CRDA to update world regulatory domain
[ 0.195000] NetLabel: Initializing
[ 0.200000] NetLabel: domain hash size = 128
[ 0.200000] NetLabel: protocols = UNLABELED CIPSOv4
[ 0.205000] NetLabel: unlabeled traffic allowed by default
[ 0.225000] AppArmor: AppArmor Filesystem Enabled
[ 0.275000] NET: Registered protocol family 2
[ 0.275000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.285000] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[ 0.290000] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.295000] TCP: Hash tables configured (established 2048 bind 2048)
[ 0.300000] TCP reno registered
[ 0.305000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.310000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.315000] NET: Registered protocol family 1
[ 0.320000] RPC: Registered udp transport module.
[ 0.325000] RPC: Registered tcp transport module.
[ 0.330000] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.340000] NetWinder Floating Point Emulator V0.97 (extended precision)
[ 0.345000] audit: initializing netlink socket (disabled)
[ 0.350000] type=2000 audit(0.350:1): initialized
[ 0.590000] fuse init (API version 7.15)
[ 0.590000] msgmni has been set to 114
[ 0.600000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
[ 0.600000] io scheduler noop registered
[ 0.605000] io scheduler deadline registered
[ 0.610000] io scheduler cfq registered (default)
[ 0.615000] s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
[ 0.620000] s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
[ 0.625000] s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
[ 0.660000] brd: module loaded
[ 0.665000] S3C24XX NAND Driver, (c) 2004 Simtec Electronics
[ 0.665000] s3c24xx-nand s3c2416-nand: Tacls=3, 22ns Twrph0=8 60ns, Twrph1=3 22ns
[ 0.670000] s3c24xx-nand s3c2416-nand: NAND hardware ECC
[ 0.675000] NAND device: Manufacturer ID: 0xad, Chip ID: 0xf1 (Hynix NAND 128MiB 3,3V 8-bit)
[ 0.680000] Scanning device for bad blocks
[ 0.690000] Bad eraseblock 41 at 0x000000520000
[ 0.690000] Bad eraseblock 42 at 0x000000540000
[ 0.695000] Bad eraseblock 43 at 0x000000560000
……………………………………………………
中间有很多Bad eraseblock
……………………………………………………
[ 1.340000] Bad eraseblock 184 at 0x000001700000
[ 1.345000] Bad eraseblock 185 at 0x000001720000
[ 1.350000] Bad eraseblock 186 at 0x000001740000
[ 1.415000] Creating 3 MTD partitions on "NAND":
[ 1.415000] 0x000000000000-0x000000100000 : "u-boot"
[ 1.420000] 0x000000100000-0x000000500000 : "kernel"
[ 1.425000] 0x000000500000-0x000008000000 : "rootfs"
[ 1.435000] dm9000 Ethernet Driver, V1.31
[ 1.435000] dm9000 dm9000.0: eth8: Invalid ethernet MAC address. Please set using ifconfig
[ 1.445000] eth0: dm9000a at c4808300,c480c308 IRQ 59 MAC: 00:00:00:00:00:00 (chip)
[ 1.450000] libertas_sdio: Libertas SDIO driver
[ 1.455000] libertas_sdio: Copyright Pierre Ossman
[ 1.470000] j2534-usb gadget: J2534 Device Port, version: Autel J2534 2010 0001
[ 1.475000] j2534-usb gadget: j2534-usb ready
[ 1.480000] mice: PS/2 mouse device common for all mice
[ 1.485000] S3C24XX RTC, (c) 2004,2006 Simtec Electronics
[ 1.490000] s3c-rtc s3c2416-rtc: rtc disabled, re-enabling
[ 1.495000] s3c-rtc s3c2416-rtc: rtc core: registered s3c as rtc0
[ 1.500000] cpuidle: using governor ladder
[ 1.505000] sdhci: Secure Digital Host Controller Interface driver
[ 1.510000] sdhci: Copyright(c) Pierre Ossman
[ 1.520000] TCP cubic registered
[ 1.525000] NET: Registered protocol family 10
[ 1.530000] lo: Disabled Privacy Extensions
[ 1.535000] NET: Registered protocol family 17
[ 1.535000] lib80211: common routines for IEEE802.11 drivers
[ 1.545000] registered taskstats version 1
[ 1.545000] s3c-rtc s3c2416-rtc: hctosys: invalid date/time
[ 1.550000] yaffs: dev is 32505858 name is "mtdblock2" rw
[ 1.555000] yaffs: passed flags ""
[ 1.640000] VFS: Mounted root (yaffs2 filesystem) on device 31:2.
[ 1.640000] devtmpfs: error mounting -2
[ 1.645000] Freeing init memory: 160K
[ 1.655000] Failed to execute /linuxrc. Attempting defaults...
[ 1.655000] Kernel panic - not syncing: No init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
[ 1.665000] [] (unwind_backtrace+0x0/0xfc) from [] (dump_stack+0x1c/0x20)
[ 1.670000] [] (dump_stack+0x1c/0x20) from [] (panic+0x64/0x1d0)
[ 1.675000] [] (panic+0x64/0x1d0) from [] (init_post+0xac/0xd4)
[ 1.680000] [] (init_post+0xac/0xd4) from [] (kernel_init+0x130/0x17c)
[ 1.685000] [] (kernel_init+0x130/0x17c) from [] (kernel_thread_exit+0x0/0x8)
|
对于大页的flash,除了u-boot需要支持yaffs2支持外,制作根文件系统所使用的工具,即mkyaffs2imag也需要修改。
前者可参考http://blogold.chinaunix.net/u3/104447/showart_2207946.html
后者可去100ask上下载,需自己编译。
看启动信息,挂载是挂载了,但是执行不了linuxrc,以前我遇到过,就是因为没有在u-boot中添加对yaffs2的支持。
前者可参考http://blogold.chinaunix.net/u3/104447/showart_2207946.html
后者可去100ask上下载,需自己编译。
看启动信息,挂载是挂载了,但是执行不了linuxrc,以前我遇到过,就是因为没有在u-boot中添加对yaffs2的支持。