Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I want to unpack a img file via some unpackers, for example, unyaffs. unfortunately, after several attempts, without success. Can anyone help me? any reply will be appreciated, Thank you all.
by the way, How to detect the file system of a data file?
root@gpl-vm:/GPL/test/ufsd/pearl/PX-8805/Sourcecode_PX-8805/PX-8805 firmware updating# /GPL/test/ufsd/pearl/ehlers-unyaffs-44e4b2e/unyaffs ./OMG-German-4.0.4.img
Can't determine flash layout, perhaps not a yaffs2 image
## After this , I try to use ghex to find first human readable strings, so that I can calculate flash layout . unfortunately, find nothing.
So I guess it is a UBIFS image, try to mount it.
root@gpl-vm:/GPL/test/ufsd/pearl/PX-8805/Sourcecode_PX-8805/PX-8805 firmware updating# modprobe mtd
root@gpl-vm:/GPL/test/ufsd/pearl/PX-8805/Sourcecode_PX-8805/PX-8805 firmware updating# modprobe mtdblock
root@gpl-vm:/GPL/test/ufsd/pearl/PX-8805/Sourcecode_PX-8805/PX-8805 firmware updating# du -sh OMG-German-4.0.4.img
284M OMG-German-4.0.4.img
root@gpl-vm:/GPL/test/ufsd/pearl/PX-8805/Sourcecode_PX-8805/PX-8805 firmware updating# modprobe nandsim first_id_byte=0x20 second_id_byte=0xac third_id_byte=0x00 fourth_id_byte=0x15 ##512MiB, 2048 bytes page;
root@gpl-vm:/GPL/test/ufsd/pearl/PX-8805/Sourcecode_PX-8805/PX-8805 firmware updating#
root@gpl-vm:/GPL/test/ufsd/pearl/PX-8805/Sourcecode_PX-8805/PX-8805 firmware updating# dd if=OMG-German-4.0.4.img of=/dev/mtdblock0 bs=2048
144935+1 records in
144935+1 records out
296828384 bytes (297 MB) copied, 47.96 s, 6.2 MB/s
root@gpl-vm:/GPL/test/ufsd/pearl/PX-8805/Sourcecode_PX-8805/PX-8805 firmware updating#
root@gpl-vm:/GPL/test/ufsd/pearl/PX-8805/Sourcecode_PX-8805/PX-8805 firmware updating# ubiattach /dev/ubi_ctrl -m 0 -O 2048
ubiattach: error!: cannot attach mtd0
error 22 (Invalid argument)
####Why cannot mtd0 be attached?
Assume it is YAFFS2 file system image, try to mount it.
root@gpl-vm:/GPL/test/ufsd/pearl/PX-8805/Sourcecode_PX-8805/PX-8805 firmware updating# nandwrite -p /dev/mtd0 OMG-German-4.0.4.img
…..
Writing data to block 2203 at offset 0x11360000
Writing data to block 2204 at offset 0x11380000
Writing data to block 2205 at offset 0x113a0000
Writing data to block 2206 at offset 0x113c0000
Writing data to block 2207 at offset 0x113e0000
…..
root@gpl-vm:/GPL/test/ufsd/pearl/PX-8805/Sourcecode_PX-8805/PX-8805 firmware updating# mount -t yaffs2 /dev/mtdblock0
Usage: mount -V : print version
mount -h : print this help
mount : list mounted filesystems
mount -l : idem, including volume labels
So far the informational part. Next the mounting.
The command is `mount [-t fstype] something somewhere'.
Details found in /etc/fstab may be omitted.
mount -a [-t|-O] ... : mount all stuff from /etc/fstab
mount device : mount device at the known place
mount directory : mount known device here
mount -t type dev dir : ordinary mount command
Note that one does not really mount a device, one mounts
a filesystem (of the given type) found on the device.
One can also mount an already visible directory tree elsewhere:
mount --bind olddir newdir
or move a subtree:
mount --move olddir newdir
One can change the type of mount containing the directory dir:
mount --make-shared dir
mount --make-slave dir
mount --make-private dir
mount --make-unbindable dir
One can change the type of all the mounts in a mount subtree
containing the directory dir:
mount --make-rshared dir
mount --make-rslave dir
mount --make-rprivate dir
mount --make-runbindable dir
A device can be given by name, say /dev/hda1 or /dev/cdrom,
or by label, using -L label or by uuid, using -U uuid .
Other options: [-nfFrsvw] [-o options] [-p passwdfd].
For many more details, say man 8 mount .
Last edited by chinabenjamin66; 11-08-2012 at 02:29 AM.
usually (unless you have a corresponding fstab entry) mount requires both a device and a mount point as arguments. Have you tried something like the following?
Yes, I have tried your code, I forgot to post it in the original thread.
See the output:
Quote:
root@gpl-vm:/GPL/test/ufsd/pearl/PX-8805/Sourcecode_PX-8805/PX-8805 firmware updating# mount -o loop OMG-German-4.0.4.img /mnt
mount: you must specify the filesystem type
The problem is how to detect the file system of this img file.
Quote:
root@gpl-vm:/GPL/test/ufsd/pearl/PX-8805/Sourcecode_PX-8805/PX-8805 firmware updating# file OMG-German-4.0.4.img
OMG-German-4.0.4.img: data
I only know it is a data file.
Regards.
Last edited by chinabenjamin66; 11-08-2012 at 02:30 AM.
well, if it fdisk doesn't see a partition table, presumably mount won't either. Do you have dosfs-tools (or whatever the equivalent package is on your distro) installed?
Yes, follow your command, I try to install this package.
Code:
root@benjamin-virtual-machine:/home/benjamin# apt-get install dosfstools
Reading package lists... Done
Building dependency tree
Reading state information... Done
dosfstools is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 201 not upgraded.
root@benjamin-virtual-machine:/home/benjamin# dosfs
dosfsck dosfslabel
I type dosfs, and press TAB, it is not listed, what is the reason?
If dosfstools only contains dosfsck and dosfslabel, how are they used for unpacking the img file(OMG-German-4.0.4.img)?
And I viewed the manual of dosfsck and dosfslabel:
dosfsck - check and repair MS-DOS filesystems
dosfslabel - set or get MS-DOS filesystem label
Some guys suggest using qemu to open .img file, if it is a disk image. Unfortunately, this image format does not support checks.
Code:
root@gpl-vm:/GPL/test/ufsd/pearl/PX-8805/Sourcecode_PX-8805/fw_up# qemu-img check OMG-German-4.0.4.img
qemu-img: This image format does not support checks
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.