2010-03-16 02:19:11     怎么把kernel和filesystem全部放到SPI flash(M25P128)?

Document created by Aaronwu Employee on Aug 21, 2013
Version 1Show Document
  • View in full screen mode

2010-03-16 02:19:11     怎么把kernel和filesystem全部放到SPI flash(M25P128)?

zhang zhihua (CHINA)

Message: 87229   

 

我现在把开发板上的SPI flash换成了M25P128,sector size is 0x40000,我现在是想把kernel和filesystem全部放到SPI flash,所以修改内核参数把它进行分区:

 

boot loader(spi):0x0 --0x40000

 

linux kernel(spi):0x40000 -- 0x20 0000

 

filesystem(spi):0x20 0000 0x100 0000

 

但是当我往里面写入kernel和filesystem的时候运行 sf erase 0x40000 0x1c0000 或者sf erase 0x200000 0x1c0000  时却发现把u-boot也擦掉了,每次写完kernel和filesystem之后u-boot都起不来...

 

然后我试着用下面的方法进行烧写:

 

首先运行将SPI flash全部擦除,然后再通过u-boot烧写u-boot、kernel和filesystem,步骤如下:

 

sf probe 2

 

sf erase 0x0 0x100 0000

 

tftp 0x1000000 u-boot.ldr

 

sf write 0x1000000 0x0 size

 

tftp 0x1000000 vmImage

 

sf write 0x1000000 0x40000 size

 

tftp 0x1000000 rootfs.jffs2

 

sf write 0x1000000 0x20 0000  size

 

但是还是出现下面的问题:

 

SF: Got idcode 20 20 18

16384 KiB M25P128 at 0:2 is now current device

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

   Image Name:   Linux-2.6.28.10-ADI-2009R1

   Created:      2010-03-16   5:06:14 UTC

   Image Type:   Blackfin Linux Kernel Image (gzip compressed)

   Data Size:    1087339 Bytes =  1 MB

   Load Address: 00001000

   Entry Point:  001fabac

   Verifying Checksum ... OK

   Uncompressing Kernel Image ... OK

Starting Kernel at = 001fabac

Linux version 2.6.28.10-ADI-2009R1 (root@ubuntu) (gcc version 4.1.2 (ADI svn)) #

47 Mon Mar 15 22:05:49 PDT 2010

bootconsole [early_shadow0] enabled

bootconsole [early_BFuart0] enabled

early printk enabled on early_BFuart0

Board Memory: 32MB

Kernel Managed Memory: 32MB

Memory map:

  fixedcode = 0x00000400-0x00000490

  text      = 0x00001000-0x00151330

  rodata    = 0x00151330-0x001b0d04

  bss       = 0x001b1000-0x001d760c

  data      = 0x001d760c-0x001ee000

    stack   = 0x001ec000-0x001ee000

  init      = 0x001ee000-0x0020c000

  available = 0x0020c000-0x01eff000

  DMA Zone  = 0x01f00000-0x02000000

Hardware Trace Active and Enabled

Boot Mode: 3

Blackfin support (C) 2004-2009 Analog Devices, Inc.

Compiled for ADSP-BF518 Rev 0.0

Warning: Compiled for Rev 0, but running on Rev 1

Blackfin Linux support by   blackfin.uclinux.org/

Processor Speed: 400 MHz core clock and 80 MHz System Clock

NOMPU: setting up cplb tables

Instruction Cache Enabled for CPU0

Data Cache Enabled for CPU0 (write-back)

Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 7873

Kernel command line: root=/dev/mtdblock3 rw rootfstype=jffs2 clkin_hz=25000000 e

arlyprintk=serial,uart0,57600 console=ttyBF0,57600

Configuring Blackfin Priority Driven Interrupts

PID hash table entries: 128 (order: 7, 512 bytes)

I-pipe 1.10-00: pipeline enabled.

Console: colour dummy device 80x25

console [ttyBF0] enabled, bootconsole disabled

console [ttyBF0] enabled, bootconsole disabled

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

Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)

Memory available: 29352k/32768k RAM, (120k init code, 1344k kernel code, 628k da

ta, 1024k dma, 296k reserved)

Calibrating delay loop... 794.62 BogoMIPS (lpj=1589248)

Security Framework initialized

Mount-cache hash table entries: 512

Blackfin Scratchpad data SRAM: 4 KB

Blackfin L1 Data A SRAM: 16 KB (15 KB free)

Blackfin L1 Data B SRAM: 16 KB (16 KB free)

Blackfin L1 Instruction SRAM: 48 KB (42 KB free)

net_namespace: 288 bytes

NET: Registered protocol family 16

Blackfin DMA Controller

ezbrd_init(): registering device resources

NET: Registered protocol family 2

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

TCP established hash table entries: 1024 (order: 1, 8192 bytes)

TCP bind hash table entries: 1024 (order: 0, 4096 bytes)

TCP: Hash tables configured (established 1024 bind 1024)

TCP reno registered

NET: Registered protocol family 1

I-pipe: Domain Xenomai registered.

Xenomai: hal/blackfin started.

Xenomai: real-time nucleus v2.4.7 (Andalusia) loaded.

Xenomai: starting native API services.

Xenomai: starting POSIX services.

Xenomai: starting RTDM services.

JFFS2 version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.

msgmni has been set to 57

io scheduler noop registered (default)

Serial: Blackfin serial driver

bfin-uart.1: ttyBF0 at MMIO 0xffc00400 (irq = 29) is a BFIN-UART

bfin-uart.1: ttyBF1 at MMIO 0xffc02000 (irq = 31) is a BFIN-UART

brd: module loaded

bfin_mii_bus: probed

bfin_mac: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:03, irq=-1, mdc_

clk=2500000Hz(mdc_div=15)@sclk=80MHz)

bfin_mac bfin_mac.0: Blackfin on-chip Ethernet MAC driver, Version 1.1

physmap platform flash device: 00300000 at 20000000

physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank

NOR chip too large to fit in mapping. Attempting to cope...

Amd/Fujitsu Extended Query Table at 0x0040

number of CFI chips: 1

cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.

Reducing visibility of 4096KiB chip to 3072KiB

cmdlinepart partition parsing not available

RedBoot partition parsing not available

Using physmap partition information

Creating 1 MTD partitions on "physmap-flash.0":

0x00000000-0x00300000 : "file system(nor)"

m25p80 spi0.2: m25p128 (16384 Kbytes)

Creating 3 MTD partitions on "m25p80":

0x00000000-0x00040000 : "bootloader(spi)"

0x00040000-0x00200000 : "linux kernel(spi)"

0x00200000-0x01000000 : "file system(spi)"

bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_b

ase@ffc00500, dma channel@7

bfin-spi bfin-spi.1: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_b

ase@ffc03400, dma channel@5

rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0

bfin-wdt: initialized: timeout=20 sec (nowayout=0)

TCP cubic registered

NET: Registered protocol family 17

Distributed Switch Architecture driver version 0.1

eth0: detected a KSZ8893M switch

dsa slave smi: probed

rtc-bfin rtc-bfin: setting system clock to 1991-03-20 14:49:59 UTC (669480599)

Empty flash at 0x0000fffc ends at 0x00010000

CLEANMARKER node found at 0x00010000, not first node in block (0x00000000)

Empty flash at 0x0001fffc ends at 0x00020000

CLEANMARKER node found at 0x00020000, not first node in block (0x00000000)

Empty flash at 0x0002fffc ends at 0x00030000

CLEANMARKER node found at 0x00030000, not first node in block (0x00000000)

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040000: 0x0004 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040004: 0x000c in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040008: 0x9080 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0004000c: 0x1900 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040010: 0x0490 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040014: 0x3802 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040018: 0x0014 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0004001c: 0x0008 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040020: 0x80c9 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040028: 0x6450 in

stead

Further such events for this erase block will not be printed

Old JFFS2 bitmask found at 0x000405bc

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x00046710

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x000496dc

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x00058ba8

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x0005cb64

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x00061594

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x00072030

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x00075138

You cannot use older JFFS2 filesystems with newer kernels

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080000: 0x0105 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080008: 0x2011 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0008000c: 0x1900 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080010: 0x0020 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080014: 0x1770 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080018: 0x002e in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0008001c: 0x0002 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080020: 0x8024 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080028: 0x0030 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0008002c: 0x1040 in

stead

Further such events for this erase block will not be printed

Old JFFS2 bitmask found at 0x0009398c

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x000944f8

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x000bc44c

You cannot use older JFFS2 filesystems with newer kernels

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c0000: 0x0804 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c0004: 0x000c in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c0008: 0xb080 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c000c: 0x1901 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c0010: 0x00c2 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c0014: 0x502e in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c0018: 0x0069 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c001c: 0x0008 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c0020: 0x8184 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c0028: 0xf830 in

stead

Further such events for this erase block will not be printed

Old JFFS2 bitmask found at 0x000c14a8

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x000cd388

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x000cec50

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x000e2e98

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x000f1ef8

You cannot use older JFFS2 filesystems with newer kernels

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00100000: 0x1000 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00100004: 0x000c in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00100008: 0x9091 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0010000c: 0x1005 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00100010: 0x0ac1 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00100014: 0x1880 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00100018: 0x0090 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0010001c: 0x000a in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00100020: 0x0061 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00100028: 0x8000 in

stead

Further such events for this erase block will not be printed

Old JFFS2 bitmask found at 0x00104e08

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x00105c38

You cannot use older JFFS2 filesystems with newer kernels

Empty flash at 0x0010ffc4 ends at 0x00110000

CLEANMARKER node found at 0x00110000, not first node in block (0x00100000)

Empty flash at 0x0011fffc ends at 0x00120000

CLEANMARKER node found at 0x00120000, not first node in block (0x00100000)

Empty flash at 0x0012fffc ends at 0x00130000

CLEANMARKER node found at 0x00130000, not first node in block (0x00100000)

jffs2_scan_eraseblock(): Node at 0x0020000c {0x1985, 0xe002, 0x00000412) has inv

alid CRC 0xa2044002 (calculated 0x719803bf)

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00200010: 0x0412 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00200014: 0x4002 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00200018: 0x00c8 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0020001c: 0x0010 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00200020: 0x81ed in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00200028: 0x2104 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0020002c: 0x0020 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00200030: 0x0020 in

stead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00200034: 0x0020 in

stead

Further such events for this erase block will not be printed

Old JFFS2 bitmask found at 0x00204550

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x002045c4

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x00205a84

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x00207854

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x00209440

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x0020b678

You cannot use older JFFS2 filesystems with newer kernels

Old JFFS2 bitmask found at 0x0021421c

You cannot use older JFFS2 filesystems with newer kernels

VFS: Mounted root (jffs2 filesystem).

Freeing unused kernel memory: 120k freed

dma_alloc_init: dma_page @ 0x01e42000 - 256 pages at 0x01f00000

Kernel panic - not syncing: No init found.  Try passing init= option to kernel.

TranslateQuoteReplyEditDelete

 

 

2010-03-16 02:30:13     Re: 怎么把kernel和filesystem全部放到SPI flash(M25P128)?

Yi Li (CHINA)

Message: 87230   

 

我上次提到,你可以在kernel里写spi flash:

 

flash_eraseall /dev/mtd1

 

cat vmImage > /dev/mtd1

 

flash_eraseall -j /dev/mtd2

 

cat rootfs.jffs2 > /dev/mtd2

 

-Yi

QuoteReplyEditDelete

 

 

2010-03-16 03:09:47     Re: 怎么把kernel和filesystem全部放到SPI flash(M25P128)?

zhang zhihua (CHINA)

Message: 87232   

 

Hi,Yi,

 

系统是起来了,但是还是出现下面这些提示信息,而且不能一用这种方法烧写吧?不然真正批量生产怎么办?

 

rtc-bfin rtc-bfin: setting system clock to 1991-03-20 15:59:36 UTC (669484776)

Empty flash at 0x0000fffc ends at 0x00010000

CLEANMARKER node found at 0x00010000, not first node in block (0x00000000)

Empty flash at 0x0001fffc ends at 0x00020000

CLEANMARKER node found at 0x00020000, not first node in block (0x00000000)

Empty flash at 0x0002fffc ends at 0x00030000

CLEANMARKER node found at 0x00030000, not first node in block (0x00000000)

Empty flash at 0x0004fffc ends at 0x00050000

CLEANMARKER node found at 0x00050000, not first node in block (0x00040000)

Empty flash at 0x0005fffc ends at 0x00060000

CLEANMARKER node found at 0x00060000, not first node in block (0x00040000)

Empty flash at 0x0006fffc ends at 0x00070000

CLEANMARKER node found at 0x00070000, not first node in block (0x00040000)

Empty flash at 0x0008fffc ends at 0x00090000

CLEANMARKER node found at 0x00090000, not first node in block (0x00080000)

Empty flash at 0x0009fffc ends at 0x000a0000

CLEANMARKER node found at 0x000a0000, not first node in block (0x00080000)

Empty flash at 0x000afffc ends at 0x000b0000

CLEANMARKER node found at 0x000b0000, not first node in block (0x00080000)

Empty flash at 0x000cfffc ends at 0x000d0000

CLEANMARKER node found at 0x000d0000, not first node in block (0x000c0000)

Empty flash at 0x000dfffc ends at 0x000e0000

CLEANMARKER node found at 0x000e0000, not first node in block (0x000c0000)

CLEANMARKER node found at 0x000f0000, not first node in block (0x000c0000)

Empty flash at 0x0010ffc4 ends at 0x00110000

CLEANMARKER node found at 0x00110000, not first node in block (0x00100000)

Empty flash at 0x0011fffc ends at 0x00120000

CLEANMARKER node found at 0x00120000, not first node in block (0x00100000)

Empty flash at 0x0012fffc ends at 0x00130000

CLEANMARKER node found at 0x00130000, not first node in block (0x00100000)

VFS: Mounted root (jffs2 filesystem).

Freeing unused kernel memory: 120k freed

dma_alloc_init: dma_page @ 0x0020b000 - 256 pages at 0x01f00000

TranslateQuoteReplyEditDelete

 

 

2010-03-16 04:00:23     Re: 怎么把kernel和filesystem全部放到SPI flash(M25P128)?

Yi Li (CHINA)

Message: 87242   

 

Please read:   docs.blackfin.uclinux.org/doku.php?id=linux-kernel:jffs#troubleshooting

 

“sf write” 应该可以用,但你说的问题我也没法重现。我在另一个帖子里恢复。

 

-Yi

QuoteReplyEditDelete

 

 

2010-03-16 04:47:32     Re: 怎么把kernel和filesystem全部放到SPI flash(M25P128)?

zhang zhihua (CHINA)

Message: 87244   

 

thank you,Yi,

 

    sorry,我到哪去修改erase size这个参数呢?刚才找了一会没找到... ...

TranslateQuoteReplyEditDelete

 

 

2010-03-16 05:01:44     Re: 怎么把kernel和filesystem全部放到SPI flash(M25P128)?

Yi Li (CHINA)

Message: 87246   

 

"cat /proc/mtd"

 

-Yi

QuoteReplyEditDelete

 

 

2010-03-16 05:12:13     Re: 怎么把kernel和filesystem全部放到SPI flash(M25P128)?

zhang zhihua (CHINA)

Message: 87248   

 

我的是这样:

 

dev:    size   erasesize  name

mtd0: 00300000 00010000 "file system(nor)"

mtd1: 00040000 00040000 "bootloader(spi)"

mtd2: 001c0000 00040000 "linux kernel(spi)"

mtd3: 00e00000 00040000 "file system(spi)"

 

怎么把00040000 修改成其他值呢?

 

谢谢...

TranslateQuoteReplyEditDelete

 

 

2010-03-16 21:24:14     Re: 怎么把kernel和filesystem全部放到SPI flash(M25P128)?

zhang zhihua (CHINA)

Message: 87295   

 

我通过修改m25p80.c修改了erasesize的大小,我把它修改成了 00080000、00020000及00010000,可是还是出现那个提示信息,m25p128应该设置为多少才合适呢?

TranslateQuoteReplyEditDelete

 

 

2010-03-16 21:27:28     Re: 怎么把kernel和filesystem全部放到SPI flash(M25P128)?

zhang zhihua (CHINA)

Message: 87296   

 

Have resolved,thanks!

Attachments

    Outcomes