|
本文描述在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) http://blog.chinaunix.net/u1/46715/showart_366809.html
改过之后可以运行u-boot了, 但是读取 nand flash还是会出错, 如下
NAND read: device 0 offset 0, size 131072 ... warning when RE falling,do nothing
0 bytes read: ERROR
解决方法:
参考 http://blog.csdn.net/zblue78/archive/2008/02/26/2121871.aspx , 修改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<statbuf.st_size;i++,pos++) 语句修改为
pos = ( long long)offset * ( long long)528 ;
pos = ( long long) pos / ( long long)512;
for(i=0; i<statbuf.st_size; i++,pos++)
即可
# 0x100000 是kernel在Nand flash 的位置
# 0x400000 是根文件系统在Nand flash 的位置
gcc -Wall -g -o mknandflashdump mknandflashdump.c && chmod 666 nand.dump && ./mknandflashdump u-boot.bin nand.dump 0 && ./mknandflashdump uImage nand.dump 0x100000 && ./mknandflashdump root.cramfs nand.dump 0x400000
在skyeye运行u-boot成功后, 输入命令 nand read 0x30008000 0x100000 0xC13B0, 读取kernel到RAM, 在 bootm 0x30008000, OK!(0xC13B0是我的kernel的文件大小, 具体情况可以看我附上的LOG)
4. 下面是我的启动log (我的文件系统是从网上down下来的), 附件是修改后的mknandflashdump.c源码 和 我的skyeye.conf
5. 在此感谢文档中所有提到的链接的作者, 感谢他们的劳动
6. 任何问题和建议欢迎Email至 [email protected], 我很期待认识更多热爱Linux和skyeye的朋友
log:
[zhiyuan@/mnt/arm/skyeye-1.2.5_REL/2410]$gcc -Wall -g -o mknandflashdump mknandflashdump.c && chmod 666 nand.dump && ./mknandflashdump u-boot.bin nand.dump 0 && ./mknandflashdump uImage nand.dump 0x100000 && ./mknandflashdump root.cramfs nand.dump 0x400000
[zhiyuan@/mnt/arm/skyeye-1.2.5_REL/2410]$
[zhiyuan@/mnt/arm/skyeye-1.2.5_REL/2410]$skyeye
**************************** WARNING **********************************
If you want to run ELF image, you should use -e option to indicate
your elf-format image filename. Or you only want to run binary image,
you need to set the filename of the image and its entry in skyeye.conf.
***********************************************************************
Your elf file is little endian.
arch: arm
cpu info: armv4, arm920t, 41009200, ff00fff0, 2
mach info: name s3c2410x, mach_init addr 0x806b1b0
nandflash: dump ./nand.dump
file size:69206016
dbct info: turn on dbct!
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm920t mmu ops
Loaded RAM ./u-boot.bin
ERROR: s3c2410x_io_write_word(0x4c000000) = 0x00ffffff
ERROR: s3c2410x_io_write_word(0x4c00000 = 0x00048032
U-Boot 1.2.0 (Aug 14 2008 - 04:55:25)
U-Boot code: 33F80000 -> 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="<UNDEFINED>"
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 protected])
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 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< [events/0]
5 0 SW< [khelper]
6 0 SW< [kthread]
7 0 SW< [kblockd/0]
8 0 SW [pdflush]
9 0 SW [pdflush]
11 0 SW< [aio/0]
10 0 SW [kswapd0]
12 0 SW< [kseriod]
13 0 SW [mtdblockd]
......
[ 本帖最后由 zsxzy317 于 2008-6-20 16:40 编辑 ] |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
×
|