arm9260 linux编译,at91sam9260 开发环境的建立

Linux内核命令行有6个环境变量。如果即将达到或者已经超过了的话root=参数会没有传进去启动时会引发panics错误。

所以去看uboot的参数传递,没有!

现在去看下u-boot

配置内核 :

RomBOOT

>

U-Boot 1.3.4 (May 18 2010 - 21:40:34)

DRAM:  64 MB

NAND:  256 MiB

In:    serial

Out:   serial

Err:   serial

Net:   macb0

macb0: Starting autonegotiation...

macb0: Autonegotiation complete

macb0: link up, 100Mbps full-duplex (lpa: 0x41e1)

Hit any key to stop autoboot:  0

U-Boot>

U-Boot>

U-Boot>

U-Boot>

U-Boot>

U-Boot>

U-Boot>

U-Boot>

U-Boot>

U-Boot>

U-Boot>

U-Boot>

U-Boot> printenv

bootdelay=3

baudrate=115200

ethact=macb0

ethaddr=3e:36:65:ba:6f:be

ipaddr=192.168.1.254

getwayip=192.168.1.1

netmask=255.255.255.0

serverip=192.168.1.5

bootfile=uImage

bootcmd=nand read 0x22000000 0x00800000 0x20000000; bootm 0x22000000

bootargs=noinitrd console=ttyS0,115200 init=/linuxrc root=/dev/mtdblock2 rootfs=cramfs men=64M

stdin=serial

stdout=serial

stderr=serial

Environment size: 373/131067 bytes

U-Boot> tftp 0x22000000 uImage

macb0: link up, 100Mbps full-duplex (lpa: 0x41e1)

Using macb0 device

TFTP from server 192.168.1.5; our IP address is 192.168.1.254

Filename 'uImage'.

Load address: 0x22000000

Loading: #################################################################

############

done

Bytes transferred = 1119716 (1115e4 hex)

U-Boot> bootm 0x22000000

## Booting kernel from Legacy Image at 22000000 ...

Image Name:   Linux-2.6.24

Image Type:   ARM Linux Kernel Image (uncompressed)

Data Size:    1119652 Bytes =  1.1 MB

Load Address: 20008000

Entry Point:  20008000

Verifying Checksum ... OK

Loading Kernel Image ... OK

OK

Starting kernel ...

Uncompressing Linux.......................................................................... done, booting the kernel.

Linux version 2.6.24 (root@emboard) (gcc version 4.2.3 (Sourcery G++ Lite 2008q1-126)) #1 Thu May 20 22:01:58 HKT 2010

CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177

Machine: Atmel AT91SAM9260-EK

Memory policy: ECC disabled, Data cache writeback

Clocks: CPU 198 MHz, master 99 MHz, main 18.432 MHz

CPU0: D VIVT write-back cache

CPU0: I cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets

CPU0: D cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets

Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256

Kernel command line: noinitrd console=ttyS0,115200 init=/linuxrc root=/dev/mtdblock2 rootfs=cramfs men=64M

AT91: 96 gpio irqs in 3 banks

PID hash table entries: 256 (order: 8, 1024 bytes)

Console: colour dummy device 80x30

console [ttyS0] enabled

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)

Memory: 64MB = 64MB total

Memory: 62592KB available (2036K code, 195K data, 100K init)

Mount-cache hash table entries: 512

CPU: Testing write buffer coherency: ok

net_namespace: 64 bytes

NET: Registered protocol family 16

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

Time: pit clocksource has been installed.

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 2048 (order: 2, 16384 bytes)

TCP bind hash table entries: 2048 (order: 1, 8192 bytes)

TCP: Hash tables configured (established 2048 bind 2048)

TCP reno registered

NetWinder Floating Point Emulator V0.97 (double precision)

yaffs May 20 2010 21:59:45 Installing.

io scheduler noop registered

io scheduler anticipatory registered (default)

Unable to handle kernel NULL pointer dereference at virtual address 00000c20

pgd = c0004000

[00000c20] *pgd=00000000

Internal error: Oops: 0 [#1]

Modules linked in:

CPU: 0    Not tainted  (2.6.24 #1)

PC is at 0xc20

LR is at link_path_walk+0x8c/0x168

pc : [<00000c20>]    lr : []    psr: 60000013

sp : c3c79d98  ip : c022d511  fp : c3c79de4

r10: c022d516  r9 : 00000000  r8 : c022d510

r7 : 00000000  r6 : c3800d08  r5 : c3c79ee0  r4 : 00000107

r3 : 00000000  r2 : c3c79db0  r1 : c3c79da4  r0 : c3c79ee0

Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel

Control: 0005317f  Table: 20004000  DAC: 00000017

Process khelper (pid: 616, stack limit = 0xc3c78268)

Stack: (0xc3c79d98 to 0xc3c7a000)

9d80:                                                       00000101 c3c78000

9da0: 00000107 01c000e1 00000004 c022d511 c3c0d7a0 c3801a18 c3c78000 c3c263c0

9dc0: c3c79ee0 c3c0d7a0 c3801798 c022d510 00000000 00000000 c3c79e5c c3c79de8

9de0: c008479c c00838a8 c3801798 c3c0d7a0 c3c79f64 c3801698 c3c1ab20 00000101

9e00: 00000001 00000000 c3c79f34 c3c79f10 00000001 c0238e10 c0239590 c0238e10

9e20: 3f2e5100 00000000 c3c79f54 00000011 00000000 c3c27b20 c3c79ecc c3c263c0

9e40: 00000001 c3c79ee0 00000001 c022d510 c3c79e6c c3c79e60 c00848a0 c0084720

9e60: c3c79e9c c3c79e70 c0084d04 c0084888 c022d510 00000001 c3c79e9c c3c79ee0

9e80: ffffff9c c022d510 00000001 c3c79f70 c3c79ebc c3c79ea0 c00857ec c0084ad0

9ea0: c3c79ee0 c022d510 c3cfe000 c3c19dfc c3c79ed4 c3c79ec0 c00858c0 c00857a8

9ec0: 00000011 00000000 c3c79f44 c3c79ed8 c007eef8 c00858ac 00000011 00000000

9ee0: c3801798 c3c0d7a0 c3c79f64 c3801698 c3c1ab20 00000105 00000001 00000000

9f00: c3c79f34 c3c79f10 00000001 c0238e10 c0239590 c0238e10 3f2e5100 00000000

9f20: c3c79f54 00000011 00000000 c3c27b20 c3c64380 c022d510 c3c79f6c c3c79f48

9f40: c008042c c007eed8 c022d510 c3c19dfc c3cfe000 c3c79f70 00000000 00000000

9f60: c3c79fd4 c3c79f70 c00254f4 c00803fc 00000000 00000000 00000000 00000000

9f80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

9fa0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 c3c78000

9fc0: 00000000 c3c741e0 c3c79ff4 c3c79fd8 c0048700 c00254c4 00000000 00000000

9fe0: 00000000 00000000 00000000 c3c79ff8 c003bbc0 c0048630 ffffffff ffffffff

Backtrace:

[] (__link_path_walk+0x0/0xe78) from [] (link_path_walk+0x8c/0x168)

[] (link_path_walk+0x0/0x168) from [] (path_walk+0x28/0x2c)

r8:c022d510 r7:00000001 r6:c3c79ee0 r5:00000001 r4:c3c263c0

[] (path_walk+0x0/0x2c) from [] (do_path_lookup+0x244/0x274)

[] (do_path_lookup+0x0/0x274) from [] (__path_lookup_intent_open+0x54/0x94)

r8:c3c79f70 r7:00000001 r6:c022d510 r5:ffffff9c r4:c3c79ee0

[] (__path_lookup_intent_open+0x0/0x94) from [] (path_lookup_open+0x24/0x2c)

r7:c3c19dfc r6:c3cfe000 r5:c022d510 r4:c3c79ee0

[] (path_lookup_open+0x0/0x2c) from [] (open_exec+0x30/0xc0)

[] (open_exec+0x0/0xc0) from [] (do_execve+0x40/0x184)

r5:c022d510 r4:c3c64380

[] (do_execve+0x0/0x184) from [] (kernel_execve+0x40/0x8c)

r9:00000000 r8:00000000 r7:c3c79f70 r6:c3cfe000 r5:c3c19dfc

r4:c022d510

[] (kernel_execve+0x0/0x8c) from [] (____call_usermodehelper+0xe0/0xec)

r7:c3c741e0 r6:00000000 r5:c3c78000 r4:00000000

[] (____call_usermodehelper+0x0/0xec) from [] (do_exit+0x0/0x710)

r7:00000000 r6:00000000 r5:00000000 r4:00000000

Code: bad PC value.

---[ end trace e314335e86712eef ]---

atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL

atmel_usart.1: ttyS1 at MMIO 0xfffb0000 (irq = 6) is a ATMEL_SERIAL

atmel_usart.2: ttyS2 at MMIO 0xfffb4000 (irq = 7) is a ATMEL_SERIAL

RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize

ssc ssc.0: Atmel SSC device at 0xc4820000 (irq 14)

MACB_mii_bus: probed

eth0: Atmel MACB at 0xfffc4000 irq 21 (3e:36:65:ba:6f:be)

eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=ffffffff:00, irq=-1)

Driver 'sd' needs updating - please use bus_type methods

usbmon: debugfs is not available

ohci_hcd: 2006 August 04 USB 1.1 'Open' Host Controller (OHCI) Driver

at91_ohci at91_ohci: AT91 OHCI

at91_ohci at91_ohci: new USB bus registered, assigned bus number 1

at91_ohci at91_ohci: irq 20, io mem 0x00500000

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.

udc: at91_udc version 3 May 2006

mice: PS/2 mouse device common for all mice

rtc-at91sam9 at91_rtt.0: rtc core: registered at91_rtt as rtc0

rtc-at91sam9 at91_rtt.0: rtc0: SET TIME!

i2c /dev entries driver

i2c-gpio i2c-gpio: using pins 55 (SDA) and 56 (SCL)

at91sam9_wdt: invalid timeout (must be between 1 and 16)

TCP cubic registered

NET: Registered protocol family 1

NET: Registered protocol family 17

rtc-at91sam9 at91_rtt.0: hctosys: unable to read the hardware clock

VFS: Cannot open root device "mtdblock2" or unknown-block(0,0)

Please append a correct "root=" boot option; here are the available partitions:

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

现在内核已经起来了,现在就是要做文件系统了!

修改后重新启动板子可以看到mtd分区:

RomBOOT

>

U-Boot 1.3.4 (May 18 2010 - 21:40:34)

DRAM:  64 MB

NAND:  RomBOOT

>

U-Boot 1.3.4 (May 18 2010 - 21:40:34)

DRAM:  64 MB

NAND:  256 MiB

In:    serial

Out:   serial

Err:   serial

Net:   macb0

macb0: Starting autonegotiation...

macb0: Autonegotiation complete

macb0: link up, 100Mbps full-duplex (lpa: 0x41e1)

Hit any key to stop autoboot:  0

macb0: link up, 100Mbps full-duplex (lpa: 0x41e1)

Using macb0 device

TFTP from server 192.168.1.5; our IP address is 192.168.1.254

Filename 'uImage'.

Load address: 0x22000000

Loading: #################################################################

#############################

done

Bytes transferred = 1377500 (1504dc hex)

## Booting kernel from Legacy Image at 22000000 ...

Image Name:   Linux-2.6.24

Image Type:   ARM Linux Kernel Image (uncompressed)

Data Size:    1377436 Bytes =  1.3 MB

Load Address: 20008000

Entry Point:  20008000

Verifying Checksum ... OK

Loading Kernel Image ... OK

OK

Starting kernel ...

Uncompressing Linux.......................................................................................... done, booting the kernel.

Linux version 2.6.24 (root@emboard) (gcc version 4.2.3 (Sourcery G++ Lite 2008q1-126)) #2 Thu May 20 23:52:25 HKT 2010

CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177

Machine: Atmel AT91SAM9260-EK

Memory policy: ECC disabled, Data cache writeback

Clocks: CPU 198 MHz, master 99 MHz, main 18.432 MHz

CPU0: D VIVT write-back cache

CPU0: I cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets

CPU0: D cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets

Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256

Kernel command line: menm=64M noinitrd console=ttyS0,115200 init=linuxrc root=/dev/mtdblock2 rootfstype=cramfs

AT91: 96 gpio irqs in 3 banks

PID hash table entries: 256 (order: 8, 1024 bytes)

Console: colour dummy device 80x30

console [ttyS0] enabled

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)

Memory: 64MB = 64MB total

Memory: 61964KB available (2544K code, 245K data, 112K init)

Mount-cache hash table entries: 512

CPU: Testing write buffer coherency: ok

net_namespace: 64 bytes

NET: Registered protocol family 16

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

Time: pit clocksource has been installed.

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 2048 (order: 2, 16384 bytes)

TCP bind hash table entries: 2048 (order: 1, 8192 bytes)

TCP: Hash tables configured (established 2048 bind 2048)

TCP reno registered

NetWinder Floating Point Emulator V0.97 (double precision)

Installing knfsd (copyright (C) 1996 okir@monad.swb.de).

yaffs May 20 2010 23:08:52 Installing.

io scheduler noop registered

io scheduler anticipatory registered (default)

atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL

atmel_usart.1: ttyS1 at MMIO 0xfffb0000 (irq = 6) is a ATMEL_SERIAL

atmel_usart.2: ttyS2 at MMIO 0xfffb4000 (irq = 7) is a ATMEL_SERIAL

RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize

nbd: registered device at major 43

ssc ssc.0: Atmel SSC device at 0xc4820000 (irq 14)

MACB_mii_bus: probed

eth0: Atmel MACB at 0xfffc4000 irq 21 (3e:36:65:ba:6f:be)

eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=ffffffff:00, irq=-1)

Driver 'sd' needs updating - please use bus_type methods

NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)

AT91 NAND: 8-bit, Software ECC

Scanning device for bad blocks

Creating 6 MTD partitions on "at91_nand":

0x00000000-0x00400000 : "Bootstrap"

0x00400000-0x00800000 : "u-boot"

0x00800000-0x01e00000 : "kernel"

0x01e00000-0x04600000 : "fs"

0x04600000-0x08200000 : "user space0"

0x08200000-0x10000000 : "user space2"

usbmon: debugfs is not available

at91_ohci at91_ohci: AT91 OHCI

at91_ohci at91_ohci: new USB bus registered, assigned bus number 1

at91_ohci at91_ohci: irq 20, io mem 0x00500000

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.

udc: at91_udc version 3 May 2006

mice: PS/2 mouse device common for all mice

rtc-at91sam9 at91_rtt.0: rtc core: registered at91_rtt as rtc0

rtc-at91sam9 at91_rtt.0: rtc0: SET TIME!

i2c /dev entries driver

i2c-gpio i2c-gpio: using pins 55 (SDA) and 56 (SCL)

at91sam9_wdt: invalid timeout (must be between 1 and 16)

TCP cubic registered

NET: Registered protocol family 1

NET: Registered protocol family 17

RPC: Registered udp transport module.

RPC: Registered tcp transport module.

rtc-at91sam9 at91_rtt.0: hctosys: unable to read the hardware clock

Root-NFS: No NFS server available, giving up.

VFS: Unable to mount root fs via NFS, trying floppy.

VFS: Cannot open root device "mtdblock2" or unknown-block(2,0)

Please append a correct "root=" boot option; here are the available partitions:

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

3.板子通过nfs挂载主机的文件:

# /etc/exports: the access control list for filesystems which may be exported

#               to NFS clients.  See exports(5).

#

# Example for NFSv2 and NFSv3:

# /srv/homes       hostname1(rw,sync) hostname2(ro,sync)

#

# Example for NFSv4:

# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt)

# /srv/nfs4/homes  gss/krb5i(rw,sync)

#

/workdir/atmel/at91sam9260/filesyetem/rootfs *(rw,sync,no_root_squash)

root@emboard:/workdir/atmel/at91sam9260# exportfs -r

root@emboard:/workdir/atmel/at91sam9260# /etc/init.d/nfs-kernel-server restart

* Stopping NFS kernel daemon

...done.

* Unexporting directories for NFS kernel daemon...

...done.

* Exporting directories for NFS kernel daemon...

exportfs: /etc/exports [2]: Neither 'subtree_check' or 'no_subtree_check' specified for export "*:/workdir/atmel/at91sam9260/filesyetem/rootfs".

Assuming default behaviour ('no_subtree_check').

NOTE: this default has changed since nfs-utils version 1.0.x

...done.

* Starting NFS kernel daemon

...done.

@emboard:/workdir/atmel/at91sam9260# mount -t nfs 192.168.1.5:/workdir/atmel/at91sam9260/filesyetem/rootfs /mnt

root@emboard:/workdir/atmel/at91sam9260# ls /mnt/

app  bin  boot  dev  driver  etc  home  lib  linuxrc  mnt  proc  root  sbin  sys  tmp  usr  var

这样可以看到成功挂载,nfs服务器配置成功

root@emboard:/workdir/atmel/at91sam9260# umount 192.168.1.5:/workdir/atmel/at91sam9260/filesyetem/rootfs

root@emboard:/workdir/atmel/at91sam9260# ls /mnt/

hgfs

成功卸载了.

================================================

1,问题1

为什么我选择下面的这个内核配置会出现这个结果呢?

选种的话,会自己自动创建MTD分

NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)

AT91 NAND: 8-bit, Software ECC

Scanning device for bad blocks

6 cmdlinepart partitions found on MTD device at91_nand

Creating 6 MTD partitions on "at91_nand":

0x00000000-0x00020000 : "bootstrap"

0x00020000-0x00060000 : "uboot"

0x00060000-0x00080000 : "env1"

0x00080000-0x000a0000 : "env2"

0x000a0000-0x002a0000 : "linux"

0x002a0000-0x10000000 : "root"

不选中的话:

NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)

AT91 NAND: 8-bit, Software ECC

Scanning device for bad blocks

Creating 6 MTD partitions on "NAND 256MiB 3,3V 8-bit":

0x00000000-0x00400000 : "Bootstrap"

0x00400000-0x00800000 : "u-boot"

0x00800000-0x01e00000 : "kernel"

0x01e00000-0x04600000 : "fs"

0x04600000-0x08200000 : "user space0"

0x08200000-0x10000000 : "user space2"

2,NFS文件系统搭建:

主机:

安装nfs服务器端和客户端root@emboard:/workdir/atmel/at91sam9260# apt-get install portmap nfs-kernel-server

root@emboard:/workdir/atmel/at91sam9260# apt-get install portmap nfs-common

2.配置共享文件编辑/etc/exports,在其中增加要共享的目录/nfs *(rw,sync,no_subtree_check)

root@emboard:/workdir/atmel/at91sam9260# exportfs -ra

3.重启服务

root@emboard:/workdir/atmel/at91sam9260# /etc/init.d/portmap restart

root@emboard:/workdir/atmel/at91sam9260# /etc/init.d/nfs-kernel-server restart

4.客户就可以加载了

root@emboard:/workdir/atmel/at91sam9260# mount 192.168.1.5:/nfs /workdir/ -o nolock

5,设置开发板的启动参数

U-Boot>setenv bootargs mem=64M console=ttyS0 115200 root=/dev/nfs

nfsroot=192.168.1.5:/nfs/rootfs

ip=192.168.1.254:192.168.1.5:192.168.1.1:255.255.255.0::eth0:off

这样就可以看到系统通过nfs文件系统启动了.

当然要把内核关于nfs的选项选中

当开发板的系统跑起来后,可以执行这个命令来验证:

[root@microcreat /]$mount -o nolock -t nfs 192.168.1.5:/nfs/rootfs /mnt/

要加上-o nolock

内核里面关于nfs文件系统的选项选上

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值