Chinaunix首页 | 论坛 | 博客
  • 博客访问: 149889
  • 博文数量: 35
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 305
  • 用 户 组: 普通用户
  • 注册时间: 2016-02-01 12:35
个人简介

不断超越自己,将更强大!

文章分类

全部博文(35)

文章存档

2022年(1)

2017年(5)

2016年(29)

我的朋友

分类: 嵌入式

2016-02-16 17:14:31

        经过近一个月的学习与实践,终于在AT91SAM9X35EK开发板上跑起了Linux系统,用的是UBI文件系统,开发环境与不断的编译、查找资料、烧写验证,下载相关的软件,占了很多的时间,不过不断的克服困难,就能不断的前进。路很长,但需要耐心不断走下去。

开发环境为:

CentOS6.5 Linux虚拟机。

硬件为:AT91SAM9X35EK

NandFlash启动(Bootstrap+Uboot+Linux Kernel+UBI根文件系统全烧写在NandFlash中)。

使用较新的AT91Bootstrap与Uboot。

使用较新的稳定的Linux version 2.6.39(ATmel官方提供AT91SAM9X35EK的相关文件,方便移植)。


             时间主要卡在了文件系统制作与支持上,总是不成功,原因是PMECC校验要打开,烧写文件系统时,还需要加上一个Trimffs的选项(我这里使用Jlink+SAMBA2.15烧写所有的文件)。




以下为运行起来的控制台信息。


AT91Bootstrap 3.6.0 


NAND: Done to load image




U-Boot 2014.04 (Feb 15 2016 - 14:56:42)


CPU: AT91SAM9X35
Crystal frequency:       12 MHz
CPU clock        :      400 MHz
Master clock     :  133.333 MHz
DRAM:  128 MiB
WARNING: Caches not enabled
NAND:  256 MiB
MMC:   mci: 0
*** Warning - bad CRC, using default environment


In:    serial
Out:   serial
Err:   serial
Net:   macb0
Warning: failed to set MAC address


Hit any key to stop autoboot:  0 


NAND read: device 0 offset 0x200000, size 0x300000
Skipping bad block 0x00320000
 3145728 bytes read: OK
## Booting kernel from Legacy Image at 22000000 ...
   Image Name:   Linux-2.6.39
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1979360 Bytes = 1.9 MiB
   Load Address: 20008000
   Entry Point:  20008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK


Starting kernel ...


Uncompressing Linux... done, booting the kernel.
Linux version 2.6.39 (root@zhangsz.zhangsz) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-202) ) #3 Mon Feb 15 16:32:15 CST 2016
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: Atmel AT91SAM9X5-EK
Memory policy: ECC disabled, Data cache writeback
Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
Kernel command line: mem=128M console=ttyS0,115200 mtdparts=atmel_nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 125928k/125928k available, 5144k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    DMA     : 0xff000000 - 0xffe00000   (  14 MB)
    vmalloc : 0xc8800000 - 0xfee00000   ( 870 MB)
    lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .init : 0xc0008000 - 0xc0028000   ( 128 kB)
      .text : 0xc0028000 - 0xc03a515c   (3573 kB)
      .data : 0xc03a6000 - 0xc03cc8a0   ( 155 kB)
NR_IRQS:192
AT91: 128 gpio irqs in 4 banks
Console: colour dummy device 80x30
console [ttyS0] enabled
Calibrating delay loop... 199.06 BogoMIPS (lpj=995328)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
AT91: CM rev B and higher
AT91: EK rev B and higher
AT91: Power Management (with slow clock mode)
AT91: Starting after power-restored wakeup
bio: create slab at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
i2c-gpio i2c-gpio.0: using pins 62 (SDA) and 63 (SCL)
at_hdmac at_hdmac.0: Atmel AHB DMA Controller ( cpy slave ), 8 channels
at_hdmac at_hdmac.1: Atmel AHB DMA Controller ( cpy slave ), 8 channels
Switching to clocksource tcb_clksrc
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) (SUMMARY)  漏 2001-2006 Red Hat, Inc.
msgmni has been set to 245
io scheduler noop registered (default)
atmel_hlcdfb atmel_hlcdfb_base.0: 1500KiB frame buffer at 27a00000 (mapped at ffc00000)
atmel_hlcdfb atmel_hlcdfb_base.0: fb0: Atmel LCDC at 0xf8038000 (mapped at c8864000), irq 25
atmel_hlcdfb atmel_hlcdfb_ovl.0: 1500KiB frame buffer at 27000000 (mapped at ffa00000)
atmel_hlcdfb atmel_hlcdfb_ovl.0: fb1: Atmel LCDC at 0xf8038100 (mapped at c886c100), irq -6
atmel_usart.0: ttyS0 at MMIO 0xfffff200 (irq = 1) is a ATMEL_SERIAL
atmel_usart.1: ttyS1 at MMIO 0xf801c000 (irq = 5) is a ATMEL_SERIAL
brd: module loaded
loop: module loaded
ssc ssc.0: Atmel SSC device at 0xc8880000 (irq 28)
at24 0-0051: 65536 byte 24c512 EEPROM, writable, 128 bytes/write
atmel_nand atmel_nand: Using dma0chan0 for DMA transfers.
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)
atmel_pmecc_init_params
Scanning device for bad blocks
Bad eraseblock 25 at 0x000000320000
Bad eraseblock 1339 at 0x00000a760000
Bad eraseblock 1759 at 0x00000dbe0000
2 cmdlinepart partitions found on MTD device atmel_nand
Creating 2 MTD partitions on "atmel_nand":
0x000000000000-0x000000800000 : "bootstrap/uboot/kernel"
0x000000800000-0x000010000000 : "rootfs"
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    126976 bytes
UBI: smallest flash I/O unit:    2048
UBI: VID header offset:          2048 (aligned 2048)
UBI: data offset:                4096
UBI: max. sequence number:       7
UBI: attached mtd1 to ubi0
UBI: MTD device name:            "rootfs"
UBI: MTD device size:            248 MiB
UBI: number of good PEBs:        1982
UBI: number of bad PEBs:         2
UBI: number of corrupted PEBs:   0
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     1
UBI: available PEBs:             0
UBI: total number of reserved PEBs: 1982
UBI: number of PEBs reserved for bad PEB handling: 19
UBI: max/mean erase counter: 2/0
UBI: image sequence number:  42708581
UBI: background thread "ubi_bgt0d" started, PID 355
CAN device driver interface
at91_can at91sam9x5_can.1: can0: Features changed: 0x00004804 -> 0x00004004
at91_can at91sam9x5_can.1: device registered (reg_base=c88e0000, irq=30)
macb macb.0: invalid hw address, using random
macb macb.0: eth0: Features changed: 0x00004800 -> 0x00004000
MACB_mii_bus: probed
eth0: Atmel MACB at 0xf802c000 irq 24 (f6:84:b3:06:57:65)
eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:00, irq=-1)
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
atmel-ehci atmel-ehci: Atmel EHCI UHP HS
atmel-ehci atmel-ehci: new USB bus registered, assigned bus number 1
atmel-ehci atmel-ehci: irq 22, io mem 0x00700000
atmel-ehci atmel-ehci: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 3 ports detected
ohci_hcd: 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 2
at91_ohci at91_ohci: irq 22, io mem 0x00600000
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 3 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver libusual
atmel_usba_udc atmel_usba_udc: MMIO registers at 0xf803c000 mapped at c88ee000
atmel_usba_udc atmel_usba_udc: FIFO at 0x00500000 mapped at c8900000
input: gpio-keys as /devices/platform/gpio-keys/input/input0
atmel_tsadcc atmel_tsadcc: Master clock is set at: 133333333 Hz
atmel_tsadcc atmel_tsadcc: Prescaler is set at: 32
input: atmel touch screen controller as /devices/platform/atmel_tsadcc/input/input1
at91_rtc at91_rtc: rtc core: registered at91_rtc as rtc0
AT91 Real Time Clock driver.
i2c /dev entries driver
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
nf_conntrack version 0.5.0 (1967 buckets, 7868 max)
ip_tables: (C) 2000-2006 Netfilter Core Team
TCP cubic registered
NET: Registered protocol family 17
can: controller area network core (rev 20090105 abi 8)
NET: Registered protocol family 29
can: raw protocol (rev 20090105)
Registering the dns_resolver key type
at91_rtc at91_rtc: setting system clock to 2007-01-01 00:00:11 UTC (1167609611)
atmel_mci atmel_mci.0: Using dma0chan1 for DMA transfers
atmel_mci atmel_mci.0: Atmel MCI controller at 0xf0008000 irq 12, 1 slots
UBIFS: recovery needed
UBIFS: recovery completed
UBIFS: mounted UBI device 0, volume 0, name "rootfs"
UBIFS: file system size:   236302336 bytes (230764 KiB, 225 MiB, 1861 LEBs)
UBIFS: journal size:       9023488 bytes (8812 KiB, 8 MiB, 72 LEBs)
UBIFS: media format:       w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root:  0 bytes (0 KiB)
VFS: Mounted root (ubifs filesystem) on device 0:12.
Freeing init memory: 128K
#-----Start /etc/init.d/rcS 
***********************************************
             Start Linux                       
             2016 02 15                        
             AT91SAM9X35ek                     
***********************************************


Please press Enter to activate this console. / # 
/ # ls
bin      dev      home     linuxrc  proc     sbin     tmp      var
boot     etc      lib      mnt      root     sys      usr
/ # cd home/
/home # ls
hello.txt
/home # cat hello.txt 
保存的内容不能保存下来吗?重新启动呢?
/home # 




         接下来,我想,还需要不断的总结与实践,不断的完善整个流程。更进一步的学习Linux驱动,用户程序的运行,网络的应用,人机界面等等。


        有时候,一个小小的问题或是失误,就会让你灰心,让你找借口,但是,只要你不断的尝试,不断的把资料归类,不断的理清其中的正确的思路,你就会不断的向前。大胆实践,大胆的尝试,才能收获好的结果。能移植Linux我觉得只是进入Linux的第一步,还需要不断的修改与裁减内核,优化启动时间,加入用户程序,等等,才能实现自己想要的东西。


        大胆的尝试与动手实践,值得!

阅读(1667) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~