onekey-sec / ubi_reader

Collection of Python scripts for reading information about and extracting data from UBI and UBIFS images.
GNU General Public License v3.0
524 stars 136 forks source link

ubireader_extract_files goes ok, but ubireader_utils_info exits with error "File does not look like UBI data" #51

Closed nightrider77 closed 2 years ago

nightrider77 commented 3 years ago

Hello.

I have successfully extracted data from ubifs image with ubireader_extract_files. But when I try to pack it back, I run ubireader_utils_info so it will prepare the packing script. But it exits with an error:

root@localhost:~/test# ubireader_utils_info -v -r ubimgfile
guess_start_offset Found UBIFS magic number at 0
guess_filetype Looking for file type at 0
guess_filetype File looks like a UBIFS image.
usage: ubireader_utils_info [options] filepath
ubireader_utils_info: error: File does not look like UBI data.

ubireader_display_info reports this ubimgfile is a UBIFS Image, and shows Super and Master block.

jrspruitt commented 3 years ago

Hi nightrider77,

It looks like the issue is that you have a UBIFS image, not a UBI image. To get the parameters from ubireader_display_info to build a new UBI image, you need the old UBI image, not a UBIFS image, which are contained inside of UBI images. It's kind of confusing. What ever file/data you extracted the UBIFS image from, should be what you need. If all you have is an UBIFS image, you will need to probe the device it is meant for, to get what info you can for a UBI image build.

-Jason