2410 Nand flash启动Linux并挂载cramfs作为根文件系统, 报告一处BUG[attach]30987[/attach]本文描述在skyeye里从Nand flash启动u-boot和Linux, 并挂载Nand flash上的cramfs作为根文件系统, 同时报告/修正 mknandflashdump.c 里面的一个BUG; 本文环境: skyeye-1.2.5 Debian kernel 2.6.22.19 gcc version 4.2.3 (Debian 4.2.3-1) 步骤: 1.移植u-boot 参考 (U-BOOT FOR 阳初2410 v2.3) [url=http://blog./u1/46715/showart_366809.html][color=#666666]http://blog./u1/46715/showart_366809.html[/color][/url] 改过之后可以运行u-boot了, 但是读取 nand flash还是会出错, 如下 NAND read: device 0 offset 0, size 131072 ... warning when RE falling,do nothing 0 bytes read: ERROR 解决方法: 参考 [url=http://blog.csdn.net/zblue78/archive/2008/02/26/2121871.aspx][color=#666666]http://blog.csdn.net/zblue78/archive/2008/02/26/2121871.aspx[/color][/url] , 修改u-boot, 注释掉 NanD_ReadBuf中的NanD_Command (nand, NAND_CMD_READ0);这一行 2.移植kernel 参考 基于S3C2410的Linux全线移植文档.pdf, google 可以搜索到, 很不错的文档, 感谢作者 3. 运行以下命令, 就可以skyeye 完全仿真2410 nand 启动了, skyeye 里面的mknandflashdump.c有一处bug, 由于下面的数值超过了int 所能表示的范围, 会导致mknandflashdump 段错误, 修改方法是 把 int pos 改成 long long pos; 把 for(i=0,pos=(offset*528/512);i 33F9AAE8 BSS: -> 33F9FBDC RAM Configuration: Bank #0: 30000000 64 MB flash_protect ON: from 0x00000000 to 0x0001AAE7 protect on 0 protect on 1 protect on 2 protect on 3 protect on 4 flash_protect ON: from 0x00020000 to 0x0002FFFF protect on 5 Flash: 16 MB NAND: NAND flash probing at 0x4E000000 64 MB *** Warning - bad CRC or NAND, using default environment In: serial Out: serial Err: serial ERROR: s3c2410x_io_write_word(0x1900030a) = 0x00000000 ### main_loop entered: bootdelay=3 ### main_loop: bootcmd="" SMDK2410 # nand read 0x30008000 0x100000 0xC13B0 NAND read: device 0 offset 1048576, size 791472 ... 791472 bytes read: OK SMDK2410 # bootm 0x30008000 ## Booting image at 30008000 ... Image Name: linux-2.6.14.1 Created: 2008-08-12 19:09:08 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 791408 Bytes = 772.9 kB Load Address: 30008000 Entry Point: 30008040 Verifying Checksum ... OK XIP Kernel Image ... OK No initrd ## Transferring control to Linux (at address 30008040) ... Starting kernel ... Uncompressing Linux..................................................... done, booting the kernel. Linux version 2.6.14.1 (zhiyuan@debian) (gcc version 3.4.1) #3 Wed Aug 13 03:06:37 CST 2008 CPU: ARM920Tid(wb) [41009200] revision 0 (ARMvundefined/unknown) Machine: SMDK2410 Warning: bad configuration page, trying to continue Memory policy: ECC disabled, Data cache writeback CPU S3C2410 (id 0x32410000) S3C2410: core 202.800 MHz, memory 101.400 MHz, peripheral 50.700 MHz S3C2410 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 Kernel command line: noinitrd root=/dev/mtdblock2 rootfstype=cramfs console=ttySAC0,115200 init=/linuxrc mem=64M irq: clearing pending status 00004000 irq: clearing pending status 00008000 irq: clearing pending status 00800000 irq: clearing pending status 10000000 irq: clearing subpending status 00000093 PID hash table entries: 512 (order: 9, 8192 bytes) timer tcon=00500000, tcnt a509, tcfg 00000200,00000000, usec 00001e4c Console: colour dummy device 80x30 Dentry cache hash table entries: 16384 (order: 4, 65536 bytes) Inode-cache hash table entries: 8192 (order: 3, 32768 bytes) Memory: 64MB = 64MB total Memory: 63104KB available (1326K code, 268K data, 84K init) Mount-cache hash table entries: 512 CPU: Testing write buffer coherency: ok softlockup thread 0 started up. NET: Registered protocol family 16 S3C2410: Initialising architecture S3C2410 DMA Driver, (c) 2003-2004 Simtec Electronics DMA channel 0 at c4800000, irq 33 DMA channel 1 at c4800040, irq 34 DMA channel 2 at c4800080, irq 35 DMA channel 3 at c48000c0, irq 36 NetWinder Floating Point Emulator V0.97 (double precision) devfs: 2004-01-31 Richard Gooch ( [email=rgooch@atnf.csiro.au][color=#666666]rgooch@atnf.csiro.au[/color][/email] ) devfs: devfs_debug: 0x0 devfs: boot_options: 0x1 S3C2410 RTC, (c) 2004 Simtec Electronics s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2410 s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2410 s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2410 io scheduler noop registered io scheduler anticipatory registered io scheduler deadline registered io scheduler cfq registered RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize S3C24XX NAND Driver, (c) 2004 Simtec Electronics s3c2410-nand: mapped registers at c4880000 s3c2410-nand: timing: Tacls 10ns, Twrph0 30ns, Twrph1 10ns NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit) NAND_ECC_NONE selected by board driver. This is not recommended !! Scanning device for bad blocks Creating 4 MTD partitions on "NAND 64MiB 3,3V 8-bit": 0x00000000-0x00100000 : "bootloader" 0x00100000-0x00400000 : "kernel" 0x00400000-0x02c00000 : "root" 0x02d00000-0x03c00000 : "user" mice: PS/2 mouse device common for all mice NET: Registered protocol family 2 IP route cache hash table entries: 1024 (order: 0, 4096 bytes) TCP established hash table entries: 4096 (order: 2, 16384 bytes) TCP bind hash table entries: 4096 (order: 2, 16384 bytes) TCP: Hash tables configured (established 4096 bind 4096) TCP reno registered TCP bic registered NET: Registered protocol family 1 Reading data from NAND FLASH without ECC is not recommended VFS: Mounted root (cramfs filesystem) readonly. Mounted devfs on /dev Freeing init memory: 84K Reading data from NAND FLASH without ECC is not recommended Reading data from NAND FLASH without ECC is not recommended Reading data from NAND FLASH without ECC is not recommended Reading data from NAND FLASH without ECC is not recommended Reading data from NAND FLASH without ECC is not recommended init started: BusyBox v1.9.1 (2008-02-24 22:56:49 CST) Reading data from NAND FLASH without ECC is not recommended starting pid 15, tty '': '/etc/init.d/rcS' Reading data from NAND FLASH without ECC is not recommended ----------mount all ********************************************************* Tekkaman Ninja 2410 Rootfs(nfs) 2008.2 Love Linux ! ! @@ Love Ke Ke ! ! ******************************************************** starting pid 17, tty '': '/bin/sh' Can't open /dev/tty0: No such file or directory Processing /etc/profile... Set search library path in /etc/profile Set user path in /etc/profile Set PS1 in /etc/profile Done [root@/]# [root@/]# process '-/bin/sh' (pid 1 [img]http://www./bbs/images/smilies/icon_cool.gif[/img] exited. Scheduling it for restart. Can't open /dev/tty0: No such file or directory [root@/]# process '-/bin/sh' (pid 19) exited. Scheduling it for restart. Can't open /dev/tty0: No such file or directory [root@/]#ln -s /dev/vc/0 /dev/tty0 [root@/]# process '-/bin/sh' (pid 20) exited. Scheduling it for restart. [root@/]# [root@/]#ps -w Reading data from NAND FLASH without ECC is not recommended PID Uid VSZ Stat Command 1 0 2720 S init 2 0 SWN [ksoftirqd/0] 3 0 SW [watchdog/0] 4 0 SW [b]本文来自ChinaUnix博客,如果查看原文请点:[/b][url]http://blog./u3/93290/showart_1858665.html[/url] |
|
来自: danydany_ok > 《嵌入式linux》