在Linux-2.6.31上使用ubifs

來源:互聯網
上載者:User
前段時間移植了Linux-2.6.31到LPC3250上,但是在使用ubifs的時候遇到了一些問題。原來在2.7.27.8上,ubifs沒有任何問題就跑起來了,可是為何在這裡卻不行?摸索了大半天,終於搞定了,下面是過程。 主要現象是在linux-2.6.27上,ubi資訊是:Creating 1 MTD partitions on "nand0":0x000000600000-0x000001600000 : "mtd=3"device_name0:mtd=3UBI: attaching mtd1 to ubi0UBI: physical eraseblock size:   131072 bytes (128 KiB)UBI: logical eraseblock size:    129024 bytesUBI: smallest flash I/O unit:    2048UBI: sub-page size:             512UBI: VID header offset:         512 (aligned 512)UBI: data offset:               2048scanning error 0UBI: attached mtd1 to ubi0UBI: MTD device name:            "mtd=3"UBI: MTD device size:            16 MiBUBI: number of good PEBs:        127UBI: number of bad PEBs:         1UBI: max. allowed volumes:       128UBI: wear-leveling threshold:    4096UBI: number of internal volumes: 1UBI: number of user volumes:     1UBI: available PEBs:             0UBI: total number of reserved PEBs: 127UBI: number of PEBs reserved for bad PEB handling: 2UBI: max/mean erase counter: 4/1 在2.6.27上,UBI識別到了sub-page,VID header offset是512. [    1.191000] UBI: attaching mtd3 to ubi0[    1.195000] UBI: physical eraseblock size:   131072 bytes (128 KiB)[    1.201000] UBI: logical eraseblock size:    126976 bytes[    1.207000] UBI: smallest flash I/O unit:    2048[    1.212000] UBI: VID header offset:          2048 (aligned 2048)[    1.218000] UBI: data offset:                4096[    1.407000] UBI: attached mtd3 to ubi0[    1.411000] UBI: MTD device name:            "safefs"[    1.416000] UBI: MTD device size:            16 MiB[    1.421000] UBI: number of good PEBs:        128[    1.426000] UBI: number of bad PEBs:         0[    1.430000] UBI: max. allowed volumes:       128[    1.435000] UBI: wear-leveling threshold:    4096[    1.440000] UBI: number of internal volumes: 1[    1.444000] UBI: number of user volumes:     1[    1.449000] UBI: available PEBs:             0[    1.453000] UBI: total number of reserved PEBs: 128[    1.458000] UBI: number of PEBs reserved for bad PEB handling: 2[    1.464000] UBI: max/mean erase counter: 2125/17[    1.469000] UBI: image sequence number: 0[    1.473000] UBI: background thread "ubi_bgt0d" started, PID 325 而在linux-2.6.31上,卻沒有識別到sub-page,VID header offset是2048。 可是使用的是同一塊NAND FLASH,怎麼會差別這麼大?應該是MTD驅動的原因,暫時不深究了。當然,上面的對比資訊是正確啟動後的完整資訊。 最初的ubi出錯資訊是:[    1.168000] UBI: attaching mtd3 to ubi0[    1.172000] UBI: physical eraseblock size:   131072 bytes (128 KiB)[    1.179000] UBI: logical eraseblock size:   126976 bytes[    1.184000] UBI: smallest flash I/O unit:   2048[    1.189000] UBI: VID header offset:         2048 (aligned 2048)[    1.195000] UBI: data offset:                4096[    1.201000] UBI error: validate_ec_hdr: bad VID header offset 512, expected 2048[    1.209000] UBI error: validate_ec_hdr: bad EC header[    1.214000] UBI error: ubi_io_read_ec_hdr: validation failed for PEB 0[    1.221000] UBI error: ubi_init: cannot attach mtd3[    1.228000] UBI error: ubi_init: UBI error: cannot initialize UBI, error -22 解決過程:(1)在U-Boot產生ubi分區,加上2048的VID offset:ubi part safefs 2048 之後出現的資訊是:但是核心還是無法起來。但是,出現的錯誤是:[    1.122000] Creating 5 MTD partitions on "NAND 256MiB 3,3V 8-bit":[    1.129000] 0x000000000000-0x000000180000 : "boot"[    1.141000] 0x000000180000-0x0000001c0000 : "prms"[    1.152000] 0x000000200000-0x000000600000 : "kernel"[    1.163000] 0x000000600000-0x000001600000 : "safefs"[    1.174000] 0x000001600000-0x000010000000 : "rootfs"[    1.191000] UBI: attaching mtd3 to ubi0[    1.195000] UBI: physical eraseblock size:   131072 bytes (128 KiB)[    1.202000] UBI: logical eraseblock size:    126976 bytes[    1.207000] UBI: smallest flash I/O unit:    2048[    1.212000] UBI: VID header offset:          2048 (aligned 2048)[    1.218000] UBI: data offset:                4096[    1.408000] UBI: attached mtd3 to ubi0[    1.412000] UBI: MTD device name:            "safefs"[    1.417000] UBI: MTD device size:            16 MiB[    1.422000] UBI: number of good PEBs:        128[    1.426000] UBI: number of bad PEBs:         0[    1.431000] UBI: max. allowed volumes:       128[    1.435000] UBI: wear-leveling threshold:    4096[    1.440000] UBI: number of internal volumes: 1[    1.445000] UBI: number of user volumes:     1[    1.449000] UBI: available PEBs:             0[    1.454000] UBI: total number of reserved PEBs: 128[    1.458000] UBI: number of PEBs reserved for bad PEB handling: 2[    1.465000] UBI: max/mean erase counter: 4/1[    1.469000] UBI: image sequence number: 0[    1.473000] UBI: background thread "ubi_bgt0d" started, PID 325 [    2.431000] UBIFS error (pid 1): validate_sb: LEB size mismatch: 129024 in superblock, 126976 real[    2.440000] UBIFS error (pid 1): validate_sb: bad superblock, error 1     顯然,ubi已經沒有問題,現在是ubifs出現問題,問題出現在製作ubifs時候的參數不對,該用核心提示的126976,而不是原來512的時候的129024啦! (2)修改製作ubi鏡像的參數:命令改為:mkfs.ubifs -r safefs -m 2048 -e 126976 -c 128 -o safefs.ubi     重新製作安全檔案系統,安全檔案系統正常啟動! 製作ubi鏡像:mkfs.ubifs -r rootfs -m 2048 -e 126976 -c 1872 -o rootfs.imgubinize -o ubi.img -m 2048 -p 128KiB -s 2048 ubi.cfg (3)修改燒寫ubi鏡像的參數:燒寫ubi鏡像:ubiformat /dev/mtd4 -s 2048  -f ubi.img >  /dev/null 2>&1 之後,問題解決,系統成功啟動。  
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.