LinuxQuestions.org

LinuxQuestions.org (http://www.linuxquestions.org/questions/index.php)
-   Linux - Embedded & Single-board computer (http://www.linuxquestions.org/questions/forumdisplay.php?f=78)
-   -   How to detect file system of a ramdisk.img? (http://www.linuxquestions.org/questions/showthread.php?t=4175436408)

chinabenjamin66 11-09-2012 08:47 AM

How to detect file system of a ramdisk.img?
 
Hello friends,

I would like to see what are inside of ramdisk.img and system.img

please see the properties of this img:
Code:

root@benjamin-virtual-machine:/GPL/tmp# file ramdisk.img
ramdisk.img: u-boot legacy uImage, hRamdisk, Linux/ARM, RAMDisk Image (Not compressed), 168988 bytes, Mon Oct 10 14:45:04 2011, Load Address: 0x41000000, Entry Point: 0x41000000, Header CRC: 0x103531EB, Data CRC: 0xABED82A4
root@benjamin-virtual-machine:/GPL/tmp#
root@benjamin-virtual-machine:/GPL/tmp# file system.img
system.img: VMS Alpha executable
root@benjamin-virtual-machine:/GPL/tmp#

I am new learner of embedded system. Can any friend here teach me what is the basic procedure for viewing the contents of a ramdisk.img or system.img?
Any ideas will be appreciated.

theNbomr 11-09-2012 10:34 AM

Usually, RAM disks are compressed cpio archives. How to View, Modify and Recreate initrd.img has a decent summary of how to manipulate one.

--- rod.

chinabenjamin66 11-10-2012 02:06 AM

Hello theNbomr,

As you can see the code, it(ramdisk.img) is Not compressed. Anyway, I have tried your advice.

Code:


  root@gpl-vm:/GPL# mv ramdisk.img ramdisk.gz
root@gpl-vm:/GPL# gunzip ramdisk.gz

gzip: ramdisk.gz: not in gzip format
root@gpl-vm:/GPL#


theNbomr 11-10-2012 10:29 AM

So, then skip the decompression part. Just de-archive it with cpio.
--- rod.

chinabenjamin66 11-11-2012 01:09 AM

Hello theNbomr,

You are right, I tried this:
Code:

root@benjamin-virtual-machine:/GPL/tmp/ramdisk# file ramdisk.img
ramdisk.img: u-boot legacy uImage, hRamdisk, Linux/ARM, RAMDisk Image (Not compressed), 168988 bytes, Mon Oct 10 14:45:04 2011, Load Address: 0x41000000, Entry Point: 0x41000000, Header CRC: 0x103531EB, Data CRC: 0xABED82A4
root@benjamin-virtual-machine:/GPL/tmp/ramdisk# dd if=ramdisk.img of=./out64c bs=64c skip=1
2640+1 records in
2640+1 records out
168988 bytes (169 kB) copied, 0.0275843 s, 6.1 MB/s
root@benjamin-virtual-machine:/GPL/tmp/ramdisk# ll
total 344
drwxr-xr-x 2 root root  4096 Nov 11 10:45 ./
drwxr-xr-x 6 root root  4096 Nov 11 10:29 ../
-rw-r--r-- 1 root root 168988 Nov 11 10:45 out64c
-rw-r--r-- 1 root root 169052 Nov  9 21:56 ramdisk.img
root@benjamin-virtual-machine:/GPL/tmp/ramdisk# file out64c
out64c: gzip compressed data, from Unix
root@benjamin-virtual-machine:/GPL/tmp/ramdisk# cp out64c out64c.gz
root@benjamin-virtual-machine:/GPL/tmp/ramdisk# mv out64c ../
root@benjamin-virtual-machine:/GPL/tmp/ramdisk# gzip  -d out64c.gz
root@benjamin-virtual-machine:/GPL/tmp/ramdisk# ll
total 448
drwxr-xr-x 2 root root  4096 Nov 11 12:08 ./
drwxr-xr-x 6 root root  4096 Nov 11 12:08 ../
-rw-r--r-- 1 root root 276736 Nov 11 12:07 out64c
-rw-r--r-- 1 root root 169052 Nov  9 21:56 ramdisk.img
root@benjamin-virtual-machine:/GPL/tmp/ramdisk# cpio -i -F out64c
541 blocks
root@benjamin-virtual-machine:/GPL/tmp/ramdisk# ll
total 608
drwxr-xr-x 8 root root  4096 Nov 11 14:46 ./
drwxr-xr-x 6 root root  4096 Nov 11 12:08 ../
drwxrwx--x 2 root root  4096 Nov 11 14:46 data/
-rw-r--r-- 1 root root    118 Nov 11 14:46 default.prop
drwxr-xr-x 2 root root  4096 Nov 11 14:46 dev/
-rwxr-x--- 1 root root 107736 Nov 11 14:46 init*
-rwxr-x--- 1 root root  1677 Nov 11 14:46 init.goldfish.rc*
-rwxr-x--- 1 root root  17429 Nov 11 14:46 init.rc*
-rw-r--r-- 1 root root 276736 Nov 11 12:07 out64c
drwxr-xr-x 2 root root  4096 Nov 11 14:46 proc/
-rw-r--r-- 1 root root 169052 Nov  9 21:56 ramdisk.img
drwxr-x--- 2 root root  4096 Nov 11 14:46 sbin/
drwxr-xr-x 2 root root  4096 Nov 11 14:46 sys/
drwxr-xr-x 2 root root  4096 Nov 11 14:46 system/
root@benjamin-virtual-machine:/GPL/tmp/ramdisk#

Thank you very much.


All times are GMT -5. The time now is 02:10 AM.