从提取的 ubi 图像中获取内容

从提取的 ubi 图像中获取内容

我不久前转储了一个 NAND 闪存,并使用binwalk. Binwalk 可以找到 SQUASHFS 文件系统,但不幸的是,无法检索数据,因为它安装在 UBI 之上,既没有unsquashfs实用程序也sasquatch无法执行某些操作。

不过binwalk也可以找到 UBI 镜像。因此,我的下一个方法是从该图像中提取内容,最终获得 squashfs 文件系统。

为此,我想使用该ubireader工具(https://github.com/jrspruitt/ubi_reader)。

ubireader_display_info给了我以下输出:

UBI File
---------------------
Min I/O: 2048
LEB Size: 126976
PEB Size: 131072
Total Block Count: 847
Data Block Count: 377
Layout Block Count: 2
Internal Volume Block Count: 0
Unknown Block Count: 468
First UBI PEB Number: 10

Image: 1681423409
---------------------
    Image Sequence Num: 1681423409
    Volume Name:spare
    Volume Name:data1
    Volume Name:root1
    Volume Name:root0
    Volume Name:data0
    PEB Range: 0 - 855

    Volume: spare
    ---------------------
        Vol ID: 4
        Name: spare
        Block Count: 142

        Volume Record
        ---------------------
            alignment: 1
            crc: '0x743003a9'
            data_pad: 0
            errors: ''
            flags: 0
            name: u'spare'
            name_len: 5
            padding: u'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
            rec_index: 4
            reserved_pebs: 386
            upd_marker: 0
            vol_type: 'dynamic'


    Volume: data1
    ---------------------
        Vol ID: 3
        Name: data1
        Block Count: 8

        Volume Record
        ---------------------
            alignment: 1
            crc: '0xefc3e0d'
            data_pad: 0
            errors: ''
            flags: 0
            name: u'data1'
            name_len: 5
            padding: u'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
            rec_index: 3
            reserved_pebs: 34
            upd_marker: 0
            vol_type: 'dynamic'


    Volume: root1
    ---------------------
        Vol ID: 1
        Name: root1
        Block Count: 110

        Volume Record
        ---------------------
            alignment: 1
            crc: '0x4a7089bd'
            data_pad: 0
            errors: ''
            flags: 0
            name: u'root1'
            name_len: 5
            padding: u'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
            rec_index: 1
            reserved_pebs: 232
            upd_marker: 0
            vol_type: 'dynamic'


    Volume: root0
    ---------------------
        Vol ID: 0
        Name: root0
        Block Count: 108

        Volume Record
        ---------------------
            alignment: 1
            crc: '0x38a2ed27'
            data_pad: 0
            errors: ''
            flags: 0
            name: u'root0'
            name_len: 5
            padding: u'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
            rec_index: 0
            reserved_pebs: 232
            upd_marker: 0
            vol_type: 'dynamic'


    Volume: data0
    ---------------------
        Vol ID: 2
        Name: data0
        Block Count: 9

        Volume Record
        ---------------------
            alignment: 1
            crc: '0x7c2e5a97'
            data_pad: 0
            errors: ''
            flags: 0
            name: u'data0'
            name_len: 5
            padding: u'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
            rec_index: 2
            reserved_pebs: 34
            upd_marker: 0
            vol_type: 'dynamic'

有几个未知的块,我不知道这是否是一个问题,但如果我尝试使用以下命令提取文件,ubireader_extract_files则会出现以下错误:

Extracting files to: ubifs-root/1681423409/spare
extract_files Error: No inodes found
Extracting files to: ubifs-root/1681423409/data1
read Error: LEB: 10 is corrupted or has no data.
extract_files Error: 1
UBIFS Fatal: Super block error: Wrong node type.

我不确定,但我相信 UBI 映像(甚至整个转储)可能会以某种方式损坏。

我无法向我解释这一点,因为我使用的 NAND 闪存启用了内部 ECC,并且在数据表中写道:

During a READ operation, the page data is read from the array to the cache 
register, where the ECC code is calculated and compared with the ECC code 
value read from the array. If error bits are detected, the error is corrected 
in the cache register. Only corrected data is output on the I/O bus.

我可以做些什么来检索这样的数据还是我做错了什么?

相关内容