S3C2416从NAND Flash启动系统思路

发布于 2022-10-15 09:14:54 字数 4266 浏览 34 评论 0

目前系统的启动情况是:uboot在NOR flash中,上电从nor flash启动,到uboot命令行时,手动加载服务器上的uImage到内存中,然后从内存启动。
#tftp 0x30007fc0 uImage
#bootm
顺利进入系统(参考附件)。

想改为:不要手动加载服务器上的uImage,改成从nand flash加载,即从本地启动。

我目前的思路是:把rootfs放到nand中,然后挂接nand中的文件系统,实现开发板的本地启动,当然当前的uboot也是要修改的。

但我不知道这样行不行,且以前没有弄这方面的东西,不知道具体流程是怎么样,应该弄些什么,请哪位大侠了解或做过的指点一下,多谢了!

附1:目前的启动过程:U-Boot 2010.06 (Dec 23 2010 - 20:00:5 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  
J2534# tftp 0x30007fc0 uImage
dm9000 i/o: 0x28000300, id: 0x90000a46  
DM9000: running in 16 bit mode
MAC: 00:40:5c:26:0a:5b
could not establish link
Using dm9000 device
TFTP from server 192.168.0.201; our IP address is 192.168.0.200
Filename 'uImage'.
Load address: 0x30007fc0
Loading: T T #################################################################
#################################################################
##############################################################
done
Bytes transferred = 2800036 (2ab9a4 hex)
J2534# bootm
## Booting kernel from Legacy Image at 30007fc0 ...
  Image Name: Linux-2.6.36
  Created: 2011-01-21 2:28:54 UTC
  Image Type: ARM Linux Kernel Image (uncompressed)
  Data Size: 2799972 Bytes = 2.7 MiB
  Load Address: 30008000
  Entry Point: 30008000
  Verifying Checksum ... OK
  Loading 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@virtual-linux) (gcc version 4.4.5 (crosstool-NG-1.9.0) ) #468 Fri Jan 21 10:14:13 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)
………………………………………………
………………………………………………
………………………………………………
[ 1.645000] eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
[ 2.410000] IP-Config: Complete:
[ 2.410000] device=eth0, addr=192.168.0.200, mask=255.255.255.0, gw=192.168.0.1,
[ 2.415000] host=192.168.0.200, domain=, nis-domain=(none),
[ 2.420000] bootserver=192.168.0.201, rootserver=192.168.0.201, rootpath=
[ 2.430000] Looking up port of RPC 100003/2 on 192.168.0.201
[ 2.480000] Looking up port of RPC 100005/1 on 192.168.0.201
[ 2.630000] VFS: Mounted root (nfs filesystem) on device 0:14.
[ 2.645000] devtmpfs: mounted
[ 2.645000] Freeing init memory: 152K
[ 5.625000] yaffs: dev is 32505858 name is "mtdblock2" rw
[ 5.625000] yaffs: passed flags ""
[ 5.655000] yaffs: dev is 32505859 name is "mtdblock3" rw
[ 5.655000] yaffs: passed flags ""
Dec 27 00:11:37 J2534 syslog.info syslogd started: BusyBox v1.17.3
[ 8.805000] led name:led0 gpio:45
Starting Wrieless networking...
*************************************
  Welcome to J2534 FileSystem!   
Please press Enter to activate this console.  
Dec 27 00:11:55 J2534 daemon.info init: starting pid 67, tty '': '-/bin/sh'
BusyBox v1.17.3 (2010-12-10 20:18:06 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
root@J2534:/#
附2:硬件环境ARM:S3C2416
NOR FLASH: SST39VF6401B(64 Mbit (x16))
NAND FLASH: HY27UF081G2A(128M X 8b)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

半岛未凉 2022-10-22 09:14:54

自己顶下!

目前我已经确认我的uboot中有nandflash的驱动,可以顺利执行如nand erase、nand write、nand read的命令,今天已经把uImage通过nand write写到nand上去了,但还没有rootfs,启动不来。现在正在学习怎么弄rootfs。

求各位大侠指点道路,谢谢!

花之痕靓丽 2022-10-22 09:14:54

rootfs应该是可以由boot来指定分区位置

烟酉 2022-10-22 09:14:54

下一步你要确定你的linux内核 也就是uImage 已经可以支持你板上的nand flash
从你的系统启动信息看, 该kernel已经可以识别nand flash并有分区mtdblock2 mtdblock3等信息
你可以在系统启动后 用 more /proc/mtd查看更详细信息
(虽然你没说 但是我猜你当前的的rootfs是NFS mount上去的?)
然后可以规划nand flash各分区的用途 再将rootfs以kernel支持的格式 你的是yaffs 写入到该分区.
确定将rootfs写入nand flash的分区后 再在uboot命令行将bootargs 中的nfs参数改成mtdblock就是你rootfs所写入的分区

网上类似文章挺多, 可以找下作参考

秋心╮凉 2022-10-22 09:14:54

下一步你要确定你的linux内核 也就是uImage 已经可以支持你板上的nand flash
从你的系统启动信息看, 该ker ...
ironfox 发表于 2011-04-19 16:59

感谢ironfox的热情回答,正如你所说,我目前得rootfs是NFS mount上去的。现在正在制作yaffs2根文件系统,虽然网上资料蛮多的,但自己也是第一次动手,比较生疏,现在还没弄出来。

桃扇骨 2022-10-22 09:14:54

出现如下错误是啥意思:

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

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

   Created:      2011-01-21   2:28:54 UTC

   Image Type:   ARM Linux Kernel Image (uncompressed)

   Data Size:    2799972 Bytes = 2.7 MiB

   Load Address: 30008000

   Entry Point:  30008000

   Verifying Checksum ... OK

   XIP Kernel Image ... OK

OK

Starting kernel ...

data abort

pc : [<30008008>]           lr : [<33f23fa4>]

sp : 33dffb50  ip : 00000000         fp : 30008000

r10: 33f4603c  r9 : 00000695         r8 : 33dfffe0

r7 : 33dfffc4  r6 : 33e01355         r5 : 30000124  r4 : 00000000

r3 : 00000000  r2 : 30000100         r1 : 00000695  r0 : 00000000

Flags: nzCv  IRQs off  FIQs off  Mode SVC_32

Resetting CPU ...

resetting ...

OK

U-Boot 2010.06 (Apr 18 2011 - 20:12:25) 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

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

   Created:      2011-01-21   2:28:54 UTC

   Image Type:   ARM Linux Kernel Image (uncompressed)

   Data Size:    2799972 Bytes = 2.7 MiB

   Load Address: 30008000

   Entry Point:  30008000

   Verifying Checksum ... OK

   XIP Kernel Image ... OK

OK

Starting kernel ...

data abort

pc : [<30008008>]           lr : [<33f23fa4>]

sp : 33dffb50  ip : 00000000         fp : 30008000

r10: 33f4603c  r9 : 00000695         r8 : 33dfffe0

r7 : 33dfffc4  r6 : 33e01355         r5 : 30000124  r4 : 00000000

r3 : 00000000  r2 : 30000100         r1 : 00000695  r0 : 00000000

Flags: nzCv  IRQs off  FIQs off  Mode SVC_32

Resetting CPU ...

resetting ...

OK

近箐 2022-10-22 09:14:54

解决了,是kernel的入口地址有问题,改为30008040就OK 了

   Load Address: 30008000

   Entry Point:  30008040

但目前有出现了另外一个问题,

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-20110422

   Created:      2011-04-22   2:05:54 UTC

   Image Type:   ARM Linux Kernel Image (uncompressed)

   Data Size:    2789608 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) #469 Fri Apr 22 09:18:31 CST 2011
…………………………………………
…………………………………………
…………………………………………
[    0.745000] Bad eraseblock 716 at 0x000005980000
[    0.765000] Creating 4 MTD partitions on "NAND":
[    0.765000] 0x000000000000-0x000000100000 : "u-boot"
[    0.775000] 0x000000100000-0x000000500000 : "kernel"
[    0.780000] 0x000000500000-0x000002500000 : "rootfs"
[    0.785000] 0x000002500000-0x000008000000 : "work"
[    0.790000] dm9000 Ethernet Driver, V1.31
[    0.790000] dm9000 dm9000.0: eth8: Invalid ethernet MAC address. Please set using ifconfig
[    0.795000] eth0: dm9000a at c4808300,c480c308 IRQ 59 MAC: 00:00:00:00:00:00 (chip)
[    0.800000] libertas_sdio: Libertas SDIO driver
[    0.805000] libertas_sdio: Copyright Pierre Ossman
[    0.825000] j2534-usb gadget: J2534 Device Port, version: Autel J2534 2010 0001
[    0.825000] j2534-usb gadget: j2534-usb ready
[    0.830000] mice: PS/2 mouse device common for all mice
[    0.835000] S3C24XX RTC, (c) 2004,2006 Simtec Electronics
[    0.840000] s3c-rtc s3c2416-rtc: rtc disabled, re-enabling
[    0.845000] s3c-rtc s3c2416-rtc: rtc core: registered s3c as rtc0
[    0.855000] cpuidle: using governor ladder
[    0.855000] sdhci: Secure Digital Host Controller Interface driver
[    0.860000] sdhci: Copyright(c) Pierre Ossman
[    0.870000] TCP cubic registered
[    0.870000] NET: Registered protocol family 10
[    0.875000] lo: Disabled Privacy Extensions
[    0.885000] NET: Registered protocol family 17
[    0.885000] lib80211: common routines for IEEE802.11 drivers
[    0.890000] registered taskstats version 1
[    0.895000] s3c-rtc s3c2416-rtc: hctosys: invalid date/time
[    0.900000] yaffs: dev is 32505858 name is "mtdblock2" rw
[    0.905000] yaffs: passed flags ""
[    0.930000] VFS: Mounted root (yaffs2 filesystem) on device 31:2.
[    0.930000] devtmpfs: error mounting -2
[    0.935000] Freeing init memory: 160K
[    0.940000] Kernel panic - not syncing: No init found.  Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
[    0.945000] [<c0037314>] (unwind_backtrace+0x0/0xfc) from [<c0034f18>] (dump_stack+0x1c/0x20)
[    0.950000] [<c0034f18>] (dump_stack+0x1c/0x20) from [<c00590d0>] (panic+0x64/0x1d0)
[    0.955000] [<c00590d0>] (panic+0x64/0x1d0) from [<c00305c8>] (init_post+0xac/0xd4)
[    0.960000] [<c00305c8>] (init_post+0xac/0xd4) from [<c0008854>] (kernel_init+0x130/0x17c)
[    0.970000] [<c0008854>] (kernel_init+0x130/0x17c) from [<c0031af0>] (kernel_thread_exit+0x0/0x

正在找原因中,有木有哪位大侠遇见过类似的问题?多谢了!

木森分化 2022-10-22 09:14:54

内核不是启动起来了么? 挂载文件系统的地方出错了~

末蓝 2022-10-22 09:14:54

是uboot传给内核的参数不对,忘记从nand中读rootfs到内存中来了,犯了个低级错误啊,汗!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文