This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

OMAP-L138使用spi flash 关联时ubiattach 报错UBI error



采用的芯片是OMAP-138

上面有nand flash  256M 和spi flash  8M

其中nand flash 分区为mtd1-mtd10

spiflash 为mtd11-mtd14

root@d8135_brd:/# cat /proc/mtd
dev: size erasesize name
mtd0: 00020000 00020000 "UBOOT_ENV"
mtd1: 000a0000 00020000 "UBL"
mtd2: 000a0000 00020000 "UBOOT_M"
mtd3: 000a0000 00020000 "UBOOT_S"
mtd4: 00400000 00020000 "KERNEL_M"
mtd5: 00400000 00020000 "KERNEL_S"
mtd6: 03000000 00020000 "UBIFS_M"
mtd7: 03000000 00020000 "UBIFS_S"
mtd8: 00800000 00020000 "DATA_M"
mtd9: 00800000 00020000 "DATA_S"
mtd10: 08600000 00020000 "COMM"
mtd11: 00040000 00010000 "U-Boot"
mtd12: 00010000 00010000 "U-Boot Environment"
mtd13: 007b0000 00010000 "Linux"
mtd14: 00000000 00000000 "MAC Address"
root@d8135_brd:/#

/bin/ubiattach /dev/ubi_ctrl -m 10 -O 2048 -d 2

ubiattach    nand flash都是正常的

UBI: attaching mtd10 to ubi2
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: attached mtd10 to ubi2
UBI: MTD device name: "COMM"
UBI: MTD device size: 134 MiB
UBI: number of good PEBs: 1068

但是ubiattach   spi flash  就出现报错

 ubiattach /dev/ubi_ctrl -m 13 -O 2048 -d 4


UBI: attaching mtd13 to ubi4
UBI: physical eraseblock size: 65536 bytes (64 KiB)
UBI: logical eraseblock size: 63424 bytes
UBI: smallest flash I/O unit: 1
UBI: VID header offset: 2048 (aligned 2048)
UBI: data offset: 2112
UBI warning: ubi_scan: 123 PEBs are corrupted
corrupted PEBs are: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
UBI error: ubi_read_volume_table: the layout volume was not found
ubiattach: error!: cannot attach mtd13
error 22 (Invalid argument)
root@d8135_brd:/#

对于spi flash 为什么会出现ubiattach  失败的问题,应该如何处理,请帮忙看看

  • 请问在制作UBIFS镜像文件时,是否有执行./ubinize -o ubi.img -m 2048 -p 128KiB -s 512 -O 2048 ubinize.cfg类似的命令?

  • 我想就MTD13作为普通的数据分区,不是作为文件系统分区的

    按照我的理解应该是
    # flash_eraseall /dev/mtd13
    Erasing 64 Kibyte @ fa0000 -- 100 % complete.

    然后
    ubiattach /dev/ubi_ctrl -m 13 -O 2048 -d 4

    最后mount 就可以了

    mount -t ubifs ubi4_0 /mnt/

    结果出现问题了,ubiattach 出错了

    root@d8135_brd:/mnt#
    root@d8135_brd:/mnt# ubiattach /dev/ubi_ctrl -m 13 -O 2048 -d 4
    UBI: attaching mtd13 to ubi4
    UBI: physical eraseblock size:   65536 bytes (64 KiB)
    UBI: logical eraseblock size:    63424 bytes
    UBI: smallest flash I/O unit:    1
    UBI: VID header offset:          2048 (aligned 2048)
    UBI: data offset:                2112
    UBI warning: ubi_scan: 250 PEBs are corrupted
    corrupted PEBs are: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
    UBI error: ubi_read_volume_table: the layout volume was not found
    ubiattach: error!: cannot attach mtd13
               error 22 (Invalid argument)
    root@d8135_brd:/mnt#
    root@d8135_brd:/mnt#

     

    但是在ubiattach 的时候出现错误

    不知道我这样的理解是否有误,请您帮忙看看

     

  • 试试在ubiattach之前先格式化一下。

    ubiformat /dev/mtd13
  • 根据您的提示做如下操作

    root@d8135_brd:/# ubiformat /dev/mtd11
    ubiformat: mtd11 (nor), size 262144 bytes (256.0 KiB), 4 eraseblocks of 65536 bytes (64.0 KiB), min. I/O size 1 bytes
    libscan: scanning eraseblock 3 -- 100 % complete 
    ubiformat: 1 eraseblocks have valid erase counter, mean value is 1
    ubiformat: 3 eraseblocks are supposedly empty
    ubiformat: warning!: only 1 of 4 eraseblocks have valid erase counter
    ubiformat: erase counter 0 will be used for all eraseblocks
    ubiformat: note, arbitrary erase counter value may be specified using -e option
    ubiformat: continue? (yes/no)  yes
    ubiformat: use erase counter 0 for all eraseblocks
    ubiformat: warning!: VID header and data offsets on flash are 2048 and 2112, which is different to requested offsets 64 and 128
    ubiformat: use new offsets 64 and 128? (yes/no)  yes
    ubiformat: use offsets 64 and 128
    ubiformat: formatting eraseblock 3 -- 100 % complete 
    root@d8135_brd:/#
    root@d8135_brd:/#

    ubiformat  会出现提示选择 选择yes 后继续

    这个情况不知是否是正常的

     

    之前那个问题是由于片选管脚配置不正确,修复管脚错误后,使用mtd_debug  read  write  写入后重新读取都是正常的

    但是出现一个其他问题

    ubiattach /dev/ubi_ctrl -m 11

    root@d8135_brd:/# ubiattach /dev/ubi_ctrl -m 11
    UBI: attaching mtd11 to ubi1
    UBI: physical eraseblock size:   65536 bytes (64 KiB)
    UBI: logical eraseblock size:    65408 bytes
    UBI: smallest flash I/O unit:    1
    UBI: VID header offset:          64 (aligned 64)
    UBI: data offset:                128
    kernel BUG at arch/arm/mm/dma-mapping.c:412!
    Unable to handle kernel NULL pointer dereference at virtual address 00000000
    pgd = c0004000
    [00000000] *pgd=00000000
    Internal error: Oops: 817 [#1] PREEMPT
    last sysfs file: /sys/class/ubi/version
    Modules linked in:
    CPU: 0    Not tainted  (2.6.33-rc4-D8135 #502)
    PC is at __bug+0x28/0x34
    LR is at schedule+0x318/0x49c
    pc : [<c03cf870>]    lr : [<c061a698>]    psr: 60000013
    sp : c516feb0  ip : c51547e0  fp : c516febc
    r10: 00000001  r9 : c519b5e0  r8 : c514fba0
    r7 : c4cabc38  r6 : 00000000  r5 : c63fe000  r4 : c63fe000
    r3 : 00000000  r2 : 40000000  r1 : c5849c80  r0 : 00000033
    Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
    Control: 0005317f  Table: c58c0000  DAC: 00000017
    Process spi_davinci.1 (pid: 176, stack limit = 0xc516e270)
    Stack: (0xc516feb0 to 0xc5170000)
    fea0:                                     c516fedc c516fec0 c03d1130 c03cf858
    fec0: c63fe000 c516d4c0 00000000 c4cabc38 c516ff34 c516fee0 c0572b5c c03d10c8
    fee0: 00000000 00000000 c061aa98 00000001 c519b5e0 00000000 01f0e000 00005600
    ff00: 00000001 10fe0000 c054b8a8 c4cabc38 00000000 c4cabc5c 00000000 00000000
    ff20: c516d4c0 c514fba0 c516ff74 c516ff38 c0571580 c057289c c516e000 c516d4d4
    ff40: 00000000 c0571e68 c5184748 c5184740 c516d4c4 c516e000 c58570a0 c5184740
    ff60: c0748200 c0571444 c516ffc4 c516ff78 c03ff4ac c0571454 c516ffc4 c5184748
    ff80: c061a698 00000000 c58570a0 c0403d2c c516ff90 c516ff90 c516ffc4 c516ffcc
    ffa0: c5819d28 c5184740 c03ff2d0 00000000 00000000 00000000 c516fff4 c516ffc8
    ffc0: c04037e0 c03ff2e0 00000000 00000000 c516ffd0 c516ffd0 00000000 00000000
    ffe0: 00000000 00000000 00000000 c516fff8 c03e81a0 c040375c c34d5fdf c344ad6b
    Backtrace:
    [<c03cf848>] (__bug+0x0/0x34) from [<c03d1130>] (dma_cache_maint+0x78/0xd8)
    [<c03d10b8>] (dma_cache_maint+0x0/0xd8) from [<c0572b5c>] (davinci_spi_bufs_dma+0x2d0/0x4b4)
     r7:c4cabc38 r6:00000000 r5:c516d4c0 r4:c63fe000
    [<c057288c>] (davinci_spi_bufs_dma+0x0/0x4b4) from [<c0571580>] (bitbang_work+0x13c/0x3b4)
    [<c0571444>] (bitbang_work+0x0/0x3b4) from [<c03ff4ac>] (worker_thread+0x1dc/0x308)
    [<c03ff2d0>] (worker_thread+0x0/0x308) from [<c04037e0>] (kthread+0x94/0x9c)
    [<c040374c>] (kthread+0x0/0x9c) from [<c03e81a0>] (do_exit+0x0/0x77c)
     r7:00000000 r6:00000000 r5:00000000 r4:00000000
    Code: e1a01000 e59f000c eb092a68 e3a03000 (e5833000)
    ---[ end trace a258f8ea1501e621 ]---
    Kernel panic - not syncing: Fatal exception
    Backtrace:
    [<c03cfc60>] (dump_backtrace+0x0/0x130) from [<c061a11c>] (dump_stack+0x20/0x24)
     r7:c516fcc7 r6:c074bba8 r5:00000000 r4:c516e000
    [<c061a0fc>] (dump_stack+0x0/0x24) from [<c061a18c>] (panic+0x6c/0xf0)
    [<c061a120>] (panic+0x0/0xf0) from [<c03d0060>] (die+0x2d0/0x324)
     r3:c06c7bb4 r2:00000001 r1:60000013 r0:c0681cf4
    [<c03cfd90>] (die+0x0/0x324) from [<c03d1b78>] (__do_kernel_fault+0x74/0x84)
    [<c03d1b04>] (__do_kernel_fault+0x0/0x84) from [<c03d1ce4>] (do_page_fault+0x15c/0x214)
     r7:00000000 r6:00000000 r5:c58570a0 r4:c06c3c18
    [<c03d1b88>] (do_page_fault+0x0/0x214) from [<c03cb324>] (do_DataAbort+0x44/0xa8)
    [<c03cb2e0>] (do_DataAbort+0x0/0xa8) from [<c03cbbac>] (__dabt_svc+0x4c/0x60)
    Exception stack(0xc516fe68 to 0xc516feb0)
    fe60:                   00000033 c5849c80 40000000 00000000 c63fe000 c63fe000
    fe80: 00000000 c4cabc38 c514fba0 c519b5e0 00000001 c516febc c51547e0 c516feb0
    fea0: c061a698 c03cf870 60000013 ffffffff
     r8:c514fba0 r7:c4cabc38 r6:00000000 r5:c516fe9c r4:ffffffff
    [<c03cf848>] (__bug+0x0/0x34) from [<c03d1130>] (dma_cache_maint+0x78/0xd8)
    [<c03d10b8>] (dma_cache_maint+0x0/0xd8) from [<c0572b5c>] (davinci_spi_bufs_dma+0x2d0/0x4b4)
     r7:c4cabc38 r6:00000000 r5:c516d4c0 r4:c63fe000
    [<c057288c>] (davinci_spi_bufs_dma+0x0/0x4b4) from [<c0571580>] (bitbang_work+0x13c/0x3b4)
    [<c0571444>] (bitbang_work+0x0/0x3b4) from [<c03ff4ac>] (worker_thread+0x1dc/0x308)
    [<c03ff2d0>] (worker_thread+0x0/0x308) from [<c04037e0>] (kthread+0x94/0x9c)
    [<c040374c>] (kthread+0x0/0x9c) from [<c03e81a0>] (do_exit+0x0/0x77c)
     r7:00000000 r6:00000000 r5:00000000 r4:00000000

    使用mkfs.vfat /dev/mtdblock11  也是会出现类似的错误

    root@d8135_brd:/# mkfs.vfat /dev/mtdblock11
    kernel BUG at arch/arm/mm/dma-mapping.c:412!
    Unable to handle kernel NULL pointer dereference at virtual address 00000000
    pgd = c0004000
    [00000000] *pgd=00000000
    Internal error: Oops: 817 [#1] PREEMPT
    last sysfs file: /sys/devices/virtual/ubi/ubi0/min_io_size
    Modules linked in:
    CPU: 0    Not tainted  (2.6.33-rc4-D8135 #502)
    PC is at __bug+0x28/0x34
    LR is at release_console_sem+0x1d8/0x25c
    pc : [<c03cf870>]    lr : [<c03e4fa0>]    psr: 60000013
    sp : c515deb0  ip : c0409ed4  fp : c515debc
    r10: 00000001  r9 : c519c5e0  r8 : c514fba0
    r7 : c515fe78  r6 : 00000000  r5 : c63da000  r4 : c63da000
    r3 : 00000000  r2 : c06c7bd4  r1 : 000026d6  r0 : 00000033
    Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
    Control: 0005317f  Table: c58c0000  DAC: 00000017
    Process spi_davinci.1 (pid: 176, stack limit = 0xc515c270)
    Stack: (0xc515deb0 to 0xc515e000)
    dea0:                                     c515dedc c515dec0 c03d1130 c03cf858
    dec0: c63da000 c51a24c0 00000000 c515fe78 c515df34 c515dee0 c0572b5c c03d10c8
    dee0: 00000000 00000000 c061aa98 00000001 c519c5e0 00000000 01f0e000 00010000
    df00: 00000001 10fe0000 c054b8a8 c515fe78 00000000 c515fe9c 00000000 00000000
    df20: c51a24c0 c514fba0 c515df74 c515df38 c0571580 c057289c c515c000 c51a24d4
    df40: 00000000 c0571e68 c5183748 c5183740 c51a24c4 c515c000 c5849380 c5183740
    df60: c0748200 c0571444 c515dfc4 c515df78 c03ff4ac c0571454 c515dfc4 c5183748
    df80: c061a698 00000000 c5849380 c0403d2c c515df90 c515df90 c515dfc4 c515dfcc
    dfa0: c5819d28 c5183740 c03ff2d0 00000000 00000000 00000000 c515dff4 c515dfc8
    dfc0: c04037e0 c03ff2e0 00000000 00000000 c515dfd0 c515dfd0 00000000 00000000
    dfe0: 00000000 00000000 00000000 c515dff8 c03e81a0 c040375c 00000000 00000000
    Backtrace:
    [<c03cf848>] (__bug+0x0/0x34) from [<c03d1130>] (dma_cache_maint+0x78/0xd8)
    [<c03d10b8>] (dma_cache_maint+0x0/0xd8) from [<c0572b5c>] (davinci_spi_bufs_dma+0x2d0/0x4b4)
     r7:c515fe78 r6:00000000 r5:c51a24c0 r4:c63da000
    [<c057288c>] (davinci_spi_bufs_dma+0x0/0x4b4) from [<c0571580>] (bitbang_work+0x13c/0x3b4)
    [<c0571444>] (bitbang_work+0x0/0x3b4) from [<c03ff4ac>] (worker_thread+0x1dc/0x308)
    [<c03ff2d0>] (worker_thread+0x0/0x308) from [<c04037e0>] (kthread+0x94/0x9c)
    [<c040374c>] (kthread+0x0/0x9c) from [<c03e81a0>] (do_exit+0x0/0x77c)
     r7:00000000 r6:00000000 r5:00000000 r4:00000000
    Code: e1a01000 e59f000c eb092a68 e3a03000 (e5833000)

     

    请问这种情况有什么好的解决方法吗

     

     

     

     

  • Hi Suizhou:

    請問您

    片选"管脚配置不正确",修复管脚错误后,使用mtd_debug  read  write  写入后重新读取都是正常的

    這個管脚配置不正确 是硬體接線問題還是軟體設置問題??

    謝謝

    Kenny

  • 我这边之前是软件设置不正确